🚚 Rename 'ItemStruct' to 'Item'
This commit is contained in:
parent
a207644d88
commit
bb2dfdfb73
24 changed files with 202 additions and 202 deletions
|
|
@ -444,7 +444,7 @@ int CapStatPointsToAdd(int remainingStatPoints, const Player &player, CharacterA
|
||||||
return std::min(remainingStatPoints, pointsToReachCap);
|
return std::min(remainingStatPoints, pointsToReachCap);
|
||||||
}
|
}
|
||||||
|
|
||||||
int DrawDurIcon4Item(const Surface &out, ItemStruct &pItem, int x, int c)
|
int DrawDurIcon4Item(const Surface &out, Item &pItem, int x, int c)
|
||||||
{
|
{
|
||||||
if (pItem.isEmpty())
|
if (pItem.isEmpty())
|
||||||
return x;
|
return x;
|
||||||
|
|
|
||||||
|
|
@ -585,7 +585,7 @@ Size GetItemSizeOnSlot(int slot, char &itemInvId)
|
||||||
iv = -ii;
|
iv = -ii;
|
||||||
}
|
}
|
||||||
|
|
||||||
ItemStruct &item = myPlayer.InvList[iv - 1];
|
Item &item = myPlayer.InvList[iv - 1];
|
||||||
if (!item.isEmpty()) {
|
if (!item.isEmpty()) {
|
||||||
auto size = GetInvItemSize(item._iCurs + CURSOR_FIRSTITEM);
|
auto size = GetInvItemSize(item._iCurs + CURSOR_FIRSTITEM);
|
||||||
size.width /= InventorySlotSizeInPixels.width;
|
size.width /= InventorySlotSizeInPixels.width;
|
||||||
|
|
@ -1467,7 +1467,7 @@ void PerformSpellAction()
|
||||||
|
|
||||||
void CtrlUseInvItem()
|
void CtrlUseInvItem()
|
||||||
{
|
{
|
||||||
ItemStruct *item;
|
Item *item;
|
||||||
|
|
||||||
if (pcursinvitem == -1)
|
if (pcursinvitem == -1)
|
||||||
return;
|
return;
|
||||||
|
|
|
||||||
|
|
@ -649,7 +649,7 @@ void CelDrawLightRedTo(const Surface &out, Point position, const CelSprite &cel,
|
||||||
RenderCelWithLightTable(out, position, pRLEBytes, nDataSize, cel.Width(frame), GetLightTable(1));
|
RenderCelWithLightTable(out, position, pRLEBytes, nDataSize, cel.Width(frame), GetLightTable(1));
|
||||||
}
|
}
|
||||||
|
|
||||||
void CelDrawItem(const ItemStruct &item, const Surface &out, Point position, const CelSprite &cel, int frame)
|
void CelDrawItem(const Item &item, const Surface &out, Point position, const CelSprite &cel, int frame)
|
||||||
{
|
{
|
||||||
bool usable = item._iStatFlag;
|
bool usable = item._iStatFlag;
|
||||||
if (!usable) {
|
if (!usable) {
|
||||||
|
|
|
||||||
|
|
@ -91,7 +91,7 @@ void CelDrawLightRedTo(const Surface &out, Point position, const CelSprite &cel,
|
||||||
* @param cel CEL sprite
|
* @param cel CEL sprite
|
||||||
* @param frame CEL frame number
|
* @param frame CEL frame number
|
||||||
*/
|
*/
|
||||||
void CelDrawItem(const ItemStruct &item, const Surface &out, Point position, const CelSprite &cel, int frame);
|
void CelDrawItem(const Item &item, const Surface &out, Point position, const CelSprite &cel, int frame);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @brief Blit a solid colder shape one pixel larger than the given sprite shape, to the target buffer at the given coordianates
|
* @brief Blit a solid colder shape one pixel larger than the given sprite shape, to the target buffer at the given coordianates
|
||||||
|
|
|
||||||
|
|
@ -181,7 +181,7 @@ void AddItemToInvGrid(Player &player, int invGridIndex, int invListIndex, Size i
|
||||||
* @param item The item whose size is to be determined.
|
* @param item The item whose size is to be determined.
|
||||||
* @return The size, in inventory cells, of the item.
|
* @return The size, in inventory cells, of the item.
|
||||||
*/
|
*/
|
||||||
Size GetInventorySize(const ItemStruct &item)
|
Size GetInventorySize(const Item &item)
|
||||||
{
|
{
|
||||||
int itemSizeIndex = item._iCurs + CURSOR_FIRSTITEM;
|
int itemSizeIndex = item._iCurs + CURSOR_FIRSTITEM;
|
||||||
auto size = GetInvItemSize(itemSizeIndex);
|
auto size = GetInvItemSize(itemSizeIndex);
|
||||||
|
|
@ -194,7 +194,7 @@ Size GetInventorySize(const ItemStruct &item)
|
||||||
* @param item The item to be checked.
|
* @param item The item to be checked.
|
||||||
* @return 'True' in case the item can fit a belt slot and 'False' otherwise.
|
* @return 'True' in case the item can fit a belt slot and 'False' otherwise.
|
||||||
*/
|
*/
|
||||||
bool FitsInBeltSlot(const ItemStruct &item)
|
bool FitsInBeltSlot(const Item &item)
|
||||||
{
|
{
|
||||||
return GetInventorySize(item) == Size { 1, 1 };
|
return GetInventorySize(item) == Size { 1, 1 };
|
||||||
}
|
}
|
||||||
|
|
@ -205,7 +205,7 @@ bool FitsInBeltSlot(const ItemStruct &item)
|
||||||
* @param item The item to be checked.
|
* @param item The item to be checked.
|
||||||
* @return 'True' in case the item can be placed on the belt and 'False' otherwise.
|
* @return 'True' in case the item can be placed on the belt and 'False' otherwise.
|
||||||
*/
|
*/
|
||||||
bool CanBePlacedOnBelt(const ItemStruct &item)
|
bool CanBePlacedOnBelt(const Item &item)
|
||||||
{
|
{
|
||||||
return FitsInBeltSlot(item)
|
return FitsInBeltSlot(item)
|
||||||
&& item._itype != ITYPE_GOLD
|
&& item._itype != ITYPE_GOLD
|
||||||
|
|
@ -219,27 +219,27 @@ bool CanBePlacedOnBelt(const ItemStruct &item)
|
||||||
* @param item The item to check.
|
* @param item The item to check.
|
||||||
* @return 'True' in case the item could be equipped in a player, and 'False' otherwise.
|
* @return 'True' in case the item could be equipped in a player, and 'False' otherwise.
|
||||||
*/
|
*/
|
||||||
bool CanEquip(const ItemStruct &item)
|
bool CanEquip(const Item &item)
|
||||||
{
|
{
|
||||||
return item.isEquipment()
|
return item.isEquipment()
|
||||||
&& item._iStatFlag;
|
&& item._iStatFlag;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @brief A specialized version of 'CanEquip(int, ItemStruct&, int)' that specifically checks whether the item can be equipped
|
* @brief A specialized version of 'CanEquip(int, Item&, int)' that specifically checks whether the item can be equipped
|
||||||
* in one/both of the player's hands.
|
* in one/both of the player's hands.
|
||||||
* @param player The player whose inventory will be checked for compatibility with the item.
|
* @param player The player whose inventory will be checked for compatibility with the item.
|
||||||
* @param item The item to check.
|
* @param item The item to check.
|
||||||
* @return 'True' if the player can currently equip the item in either one of his hands (i.e. the required hands are empty and
|
* @return 'True' if the player can currently equip the item in either one of his hands (i.e. the required hands are empty and
|
||||||
* allow the item), and 'False' otherwise.
|
* allow the item), and 'False' otherwise.
|
||||||
*/
|
*/
|
||||||
bool CanWield(Player &player, const ItemStruct &item)
|
bool CanWield(Player &player, const Item &item)
|
||||||
{
|
{
|
||||||
if (!CanEquip(item) || (item._iLoc != ILOC_ONEHAND && item._iLoc != ILOC_TWOHAND))
|
if (!CanEquip(item) || (item._iLoc != ILOC_ONEHAND && item._iLoc != ILOC_TWOHAND))
|
||||||
return false;
|
return false;
|
||||||
|
|
||||||
ItemStruct &leftHandItem = player.InvBody[INVLOC_HAND_LEFT];
|
Item &leftHandItem = player.InvBody[INVLOC_HAND_LEFT];
|
||||||
ItemStruct &rightHandItem = player.InvBody[INVLOC_HAND_RIGHT];
|
Item &rightHandItem = player.InvBody[INVLOC_HAND_RIGHT];
|
||||||
|
|
||||||
if (leftHandItem.isEmpty() && rightHandItem.isEmpty()) {
|
if (leftHandItem.isEmpty() && rightHandItem.isEmpty()) {
|
||||||
return true;
|
return true;
|
||||||
|
|
@ -249,7 +249,7 @@ bool CanWield(Player &player, const ItemStruct &item)
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
ItemStruct &occupiedHand = !leftHandItem.isEmpty() ? leftHandItem : rightHandItem;
|
Item &occupiedHand = !leftHandItem.isEmpty() ? leftHandItem : rightHandItem;
|
||||||
|
|
||||||
// Barbarian can wield two handed swords and maces in one hand, so we allow equiping any sword/mace as long as his occupied
|
// Barbarian can wield two handed swords and maces in one hand, so we allow equiping any sword/mace as long as his occupied
|
||||||
// hand has a shield (i.e. no dual wielding allowed)
|
// hand has a shield (i.e. no dual wielding allowed)
|
||||||
|
|
@ -285,7 +285,7 @@ bool CanWield(Player &player, const ItemStruct &item)
|
||||||
* @return 'True' if the player can currently equip the item in the specified body location (i.e. the body location is empty and
|
* @return 'True' if the player can currently equip the item in the specified body location (i.e. the body location is empty and
|
||||||
* allows the item), and 'False' otherwise.
|
* allows the item), and 'False' otherwise.
|
||||||
*/
|
*/
|
||||||
bool CanEquip(Player &player, const ItemStruct &item, inv_body_loc bodyLocation)
|
bool CanEquip(Player &player, const Item &item, inv_body_loc bodyLocation)
|
||||||
{
|
{
|
||||||
if (!CanEquip(item) || player._pmode > PM_WALK3 || !player.InvBody[bodyLocation].isEmpty()) {
|
if (!CanEquip(item) || player._pmode > PM_WALK3 || !player.InvBody[bodyLocation].isEmpty()) {
|
||||||
return false;
|
return false;
|
||||||
|
|
@ -324,7 +324,7 @@ bool CanEquip(Player &player, const ItemStruct &item, inv_body_loc bodyLocation)
|
||||||
* whether the player can equip the item but you don't want the item to actually be equipped. 'True' by default.
|
* whether the player can equip the item but you don't want the item to actually be equipped. 'True' by default.
|
||||||
* @return 'True' if the item was equipped and 'False' otherwise.
|
* @return 'True' if the item was equipped and 'False' otherwise.
|
||||||
*/
|
*/
|
||||||
bool AutoEquip(int playerId, const ItemStruct &item, inv_body_loc bodyLocation, bool persistItem)
|
bool AutoEquip(int playerId, const Item &item, inv_body_loc bodyLocation, bool persistItem)
|
||||||
{
|
{
|
||||||
auto &player = Players[playerId];
|
auto &player = Players[playerId];
|
||||||
|
|
||||||
|
|
@ -346,7 +346,7 @@ bool AutoEquip(int playerId, const ItemStruct &item, inv_body_loc bodyLocation,
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
int SwapItem(ItemStruct *a, ItemStruct *b)
|
int SwapItem(Item *a, Item *b)
|
||||||
{
|
{
|
||||||
std::swap(*a, *b);
|
std::swap(*a, *b);
|
||||||
|
|
||||||
|
|
@ -564,7 +564,7 @@ void CheckInvPaste(int pnum, Point cursorPosition)
|
||||||
break;
|
break;
|
||||||
case ILOC_TWOHAND:
|
case ILOC_TWOHAND:
|
||||||
if (!player.InvBody[INVLOC_HAND_LEFT].isEmpty() && !player.InvBody[INVLOC_HAND_RIGHT].isEmpty()) {
|
if (!player.InvBody[INVLOC_HAND_LEFT].isEmpty() && !player.InvBody[INVLOC_HAND_RIGHT].isEmpty()) {
|
||||||
ItemStruct tempitem = player.HoldItem;
|
Item tempitem = player.HoldItem;
|
||||||
if (player.InvBody[INVLOC_HAND_RIGHT]._itype == ITYPE_SHIELD)
|
if (player.InvBody[INVLOC_HAND_RIGHT]._itype == ITYPE_SHIELD)
|
||||||
player.HoldItem = player.InvBody[INVLOC_HAND_RIGHT];
|
player.HoldItem = player.InvBody[INVLOC_HAND_RIGHT];
|
||||||
else
|
else
|
||||||
|
|
@ -719,14 +719,14 @@ void CheckInvCut(int pnum, Point cursorPosition, bool automaticMove)
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
ItemStruct &holdItem = player.HoldItem;
|
Item &holdItem = player.HoldItem;
|
||||||
holdItem._itype = ITYPE_NONE;
|
holdItem._itype = ITYPE_NONE;
|
||||||
|
|
||||||
bool automaticallyMoved = false;
|
bool automaticallyMoved = false;
|
||||||
bool automaticallyEquipped = false;
|
bool automaticallyEquipped = false;
|
||||||
bool automaticallyUnequip = false;
|
bool automaticallyUnequip = false;
|
||||||
|
|
||||||
ItemStruct &headItem = player.InvBody[INVLOC_HEAD];
|
Item &headItem = player.InvBody[INVLOC_HEAD];
|
||||||
if (r >= SLOTXY_HEAD_FIRST && r <= SLOTXY_HEAD_LAST && !headItem.isEmpty()) {
|
if (r >= SLOTXY_HEAD_FIRST && r <= SLOTXY_HEAD_LAST && !headItem.isEmpty()) {
|
||||||
holdItem = headItem;
|
holdItem = headItem;
|
||||||
if (automaticMove) {
|
if (automaticMove) {
|
||||||
|
|
@ -740,7 +740,7 @@ void CheckInvCut(int pnum, Point cursorPosition, bool automaticMove)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
ItemStruct &leftRingItem = player.InvBody[INVLOC_RING_LEFT];
|
Item &leftRingItem = player.InvBody[INVLOC_RING_LEFT];
|
||||||
if (r == SLOTXY_RING_LEFT && !leftRingItem.isEmpty()) {
|
if (r == SLOTXY_RING_LEFT && !leftRingItem.isEmpty()) {
|
||||||
holdItem = leftRingItem;
|
holdItem = leftRingItem;
|
||||||
if (automaticMove) {
|
if (automaticMove) {
|
||||||
|
|
@ -754,7 +754,7 @@ void CheckInvCut(int pnum, Point cursorPosition, bool automaticMove)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
ItemStruct &rightRingItem = player.InvBody[INVLOC_RING_RIGHT];
|
Item &rightRingItem = player.InvBody[INVLOC_RING_RIGHT];
|
||||||
if (r == SLOTXY_RING_RIGHT && !rightRingItem.isEmpty()) {
|
if (r == SLOTXY_RING_RIGHT && !rightRingItem.isEmpty()) {
|
||||||
holdItem = rightRingItem;
|
holdItem = rightRingItem;
|
||||||
if (automaticMove) {
|
if (automaticMove) {
|
||||||
|
|
@ -768,7 +768,7 @@ void CheckInvCut(int pnum, Point cursorPosition, bool automaticMove)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
ItemStruct &amuletItem = player.InvBody[INVLOC_AMULET];
|
Item &amuletItem = player.InvBody[INVLOC_AMULET];
|
||||||
if (r == SLOTXY_AMULET && !amuletItem.isEmpty()) {
|
if (r == SLOTXY_AMULET && !amuletItem.isEmpty()) {
|
||||||
holdItem = amuletItem;
|
holdItem = amuletItem;
|
||||||
if (automaticMove) {
|
if (automaticMove) {
|
||||||
|
|
@ -782,7 +782,7 @@ void CheckInvCut(int pnum, Point cursorPosition, bool automaticMove)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
ItemStruct &leftHandItem = player.InvBody[INVLOC_HAND_LEFT];
|
Item &leftHandItem = player.InvBody[INVLOC_HAND_LEFT];
|
||||||
if (r >= SLOTXY_HAND_LEFT_FIRST && r <= SLOTXY_HAND_LEFT_LAST && !leftHandItem.isEmpty()) {
|
if (r >= SLOTXY_HAND_LEFT_FIRST && r <= SLOTXY_HAND_LEFT_LAST && !leftHandItem.isEmpty()) {
|
||||||
holdItem = leftHandItem;
|
holdItem = leftHandItem;
|
||||||
if (automaticMove) {
|
if (automaticMove) {
|
||||||
|
|
@ -796,7 +796,7 @@ void CheckInvCut(int pnum, Point cursorPosition, bool automaticMove)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
ItemStruct &rightHandItem = player.InvBody[INVLOC_HAND_RIGHT];
|
Item &rightHandItem = player.InvBody[INVLOC_HAND_RIGHT];
|
||||||
if (r >= SLOTXY_HAND_RIGHT_FIRST && r <= SLOTXY_HAND_RIGHT_LAST && !rightHandItem.isEmpty()) {
|
if (r >= SLOTXY_HAND_RIGHT_FIRST && r <= SLOTXY_HAND_RIGHT_LAST && !rightHandItem.isEmpty()) {
|
||||||
holdItem = rightHandItem;
|
holdItem = rightHandItem;
|
||||||
if (automaticMove) {
|
if (automaticMove) {
|
||||||
|
|
@ -810,7 +810,7 @@ void CheckInvCut(int pnum, Point cursorPosition, bool automaticMove)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
ItemStruct &chestItem = player.InvBody[INVLOC_CHEST];
|
Item &chestItem = player.InvBody[INVLOC_CHEST];
|
||||||
if (r >= SLOTXY_CHEST_FIRST && r <= SLOTXY_CHEST_LAST && !chestItem.isEmpty()) {
|
if (r >= SLOTXY_CHEST_FIRST && r <= SLOTXY_CHEST_LAST && !chestItem.isEmpty()) {
|
||||||
holdItem = chestItem;
|
holdItem = chestItem;
|
||||||
if (automaticMove) {
|
if (automaticMove) {
|
||||||
|
|
@ -846,7 +846,7 @@ void CheckInvCut(int pnum, Point cursorPosition, bool automaticMove)
|
||||||
}
|
}
|
||||||
|
|
||||||
if (r >= SLOTXY_BELT_FIRST) {
|
if (r >= SLOTXY_BELT_FIRST) {
|
||||||
ItemStruct &beltItem = player.SpdList[r - SLOTXY_BELT_FIRST];
|
Item &beltItem = player.SpdList[r - SLOTXY_BELT_FIRST];
|
||||||
if (!beltItem.isEmpty()) {
|
if (!beltItem.isEmpty()) {
|
||||||
holdItem = beltItem;
|
holdItem = beltItem;
|
||||||
if (automaticMove) {
|
if (automaticMove) {
|
||||||
|
|
@ -937,7 +937,7 @@ void CheckNaKrulNotes(Player &player)
|
||||||
}
|
}
|
||||||
|
|
||||||
int itemNum = ActiveItems[0];
|
int itemNum = ActiveItems[0];
|
||||||
ItemStruct tmp = Items[itemNum];
|
Item tmp = Items[itemNum];
|
||||||
memset(&Items[itemNum], 0, sizeof(*Items));
|
memset(&Items[itemNum], 0, sizeof(*Items));
|
||||||
GetItemAttrs(Items[itemNum], IDI_FULLNOTE, 16);
|
GetItemAttrs(Items[itemNum], IDI_FULLNOTE, 16);
|
||||||
SetupItem(Items[itemNum]);
|
SetupItem(Items[itemNum]);
|
||||||
|
|
@ -996,7 +996,7 @@ void CheckQuestItem(Player &player)
|
||||||
CheckNaKrulNotes(player);
|
CheckNaKrulNotes(player);
|
||||||
}
|
}
|
||||||
|
|
||||||
void CleanupItems(ItemStruct *item, int ii)
|
void CleanupItems(Item *item, int ii)
|
||||||
{
|
{
|
||||||
dItem[item->position.x][item->position.y] = 0;
|
dItem[item->position.x][item->position.y] = 0;
|
||||||
|
|
||||||
|
|
@ -1059,7 +1059,7 @@ bool PutItem(Player &player, Point &position)
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
bool CanUseStaff(ItemStruct &staff, spell_id spell)
|
bool CanUseStaff(Item &staff, spell_id spell)
|
||||||
{
|
{
|
||||||
return !staff.isEmpty()
|
return !staff.isEmpty()
|
||||||
&& (staff._iMiscId == IMISC_STAFF || staff._iMiscId == IMISC_UNIQUE)
|
&& (staff._iMiscId == IMISC_STAFF || staff._iMiscId == IMISC_UNIQUE)
|
||||||
|
|
@ -1272,7 +1272,7 @@ void DrawInvBelt(const Surface &out)
|
||||||
* @param persistItem Pass 'True' to actually place the item in the belt. The default is 'False'.
|
* @param persistItem Pass 'True' to actually place the item in the belt. The default is 'False'.
|
||||||
* @return 'True' in case the item can be placed on the player's belt and 'False' otherwise.
|
* @return 'True' in case the item can be placed on the player's belt and 'False' otherwise.
|
||||||
*/
|
*/
|
||||||
bool AutoPlaceItemInBelt(Player &player, const ItemStruct &item, bool persistItem)
|
bool AutoPlaceItemInBelt(Player &player, const Item &item, bool persistItem)
|
||||||
{
|
{
|
||||||
if (!CanBePlacedOnBelt(item)) {
|
if (!CanBePlacedOnBelt(item)) {
|
||||||
return false;
|
return false;
|
||||||
|
|
@ -1302,7 +1302,7 @@ bool AutoPlaceItemInBelt(Player &player, const ItemStruct &item, bool persistIte
|
||||||
* whether the player can equip the item but you don't want the item to actually be equipped. 'True' by default.
|
* whether the player can equip the item but you don't want the item to actually be equipped. 'True' by default.
|
||||||
* @return 'True' if the item was equipped and 'False' otherwise.
|
* @return 'True' if the item was equipped and 'False' otherwise.
|
||||||
*/
|
*/
|
||||||
bool AutoEquip(int playerId, const ItemStruct &item, bool persistItem)
|
bool AutoEquip(int playerId, const Item &item, bool persistItem)
|
||||||
{
|
{
|
||||||
if (!CanEquip(item)) {
|
if (!CanEquip(item)) {
|
||||||
return false;
|
return false;
|
||||||
|
|
@ -1323,7 +1323,7 @@ bool AutoEquip(int playerId, const ItemStruct &item, bool persistItem)
|
||||||
* @param item The item to check.
|
* @param item The item to check.
|
||||||
* @return 'True' if auto-equipping behavior is enabled for the player and item and 'False' otherwise.
|
* @return 'True' if auto-equipping behavior is enabled for the player and item and 'False' otherwise.
|
||||||
*/
|
*/
|
||||||
bool AutoEquipEnabled(const Player &player, const ItemStruct &item)
|
bool AutoEquipEnabled(const Player &player, const Item &item)
|
||||||
{
|
{
|
||||||
if (item.isWeapon()) {
|
if (item.isWeapon()) {
|
||||||
// Monk can use unarmed attack as an encouraged option, thus we do not automatically equip weapons on him so as to not
|
// Monk can use unarmed attack as an encouraged option, thus we do not automatically equip weapons on him so as to not
|
||||||
|
|
@ -1357,7 +1357,7 @@ bool AutoEquipEnabled(const Player &player, const ItemStruct &item)
|
||||||
* @param persistItem Pass 'True' to actually place the item in the inventory. The default is 'False'.
|
* @param persistItem Pass 'True' to actually place the item in the inventory. The default is 'False'.
|
||||||
* @return 'True' in case the item can be placed on the player's inventory and 'False' otherwise.
|
* @return 'True' in case the item can be placed on the player's inventory and 'False' otherwise.
|
||||||
*/
|
*/
|
||||||
bool AutoPlaceItemInInventory(Player &player, const ItemStruct &item, bool persistItem)
|
bool AutoPlaceItemInInventory(Player &player, const Item &item, bool persistItem)
|
||||||
{
|
{
|
||||||
Size itemSize = GetInventorySize(item);
|
Size itemSize = GetInventorySize(item);
|
||||||
|
|
||||||
|
|
@ -1425,7 +1425,7 @@ bool AutoPlaceItemInInventory(Player &player, const ItemStruct &item, bool persi
|
||||||
* @param persistItem Pass 'True' to actually place the item in the inventory slot. The default is 'False'.
|
* @param persistItem Pass 'True' to actually place the item in the inventory slot. The default is 'False'.
|
||||||
* @return 'True' in case the item can be placed on the specified player's inventory slot and 'False' otherwise.
|
* @return 'True' in case the item can be placed on the specified player's inventory slot and 'False' otherwise.
|
||||||
*/
|
*/
|
||||||
bool AutoPlaceItemInInventorySlot(Player &player, int slotIndex, const ItemStruct &item, bool persistItem)
|
bool AutoPlaceItemInInventorySlot(Player &player, int slotIndex, const Item &item, bool persistItem)
|
||||||
{
|
{
|
||||||
int yy = (slotIndex > 0) ? (10 * (slotIndex / 10)) : 0;
|
int yy = (slotIndex > 0) ? (10 * (slotIndex / 10)) : 0;
|
||||||
|
|
||||||
|
|
@ -1577,7 +1577,7 @@ void CheckInvScrn(bool isShiftHeld)
|
||||||
|
|
||||||
void CheckItemStats(Player &player)
|
void CheckItemStats(Player &player)
|
||||||
{
|
{
|
||||||
ItemStruct &item = player.HoldItem;
|
Item &item = player.HoldItem;
|
||||||
|
|
||||||
item._iStatFlag = false;
|
item._iStatFlag = false;
|
||||||
|
|
||||||
|
|
@ -1588,7 +1588,7 @@ void CheckItemStats(Player &player)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void InvGetItem(int pnum, ItemStruct *item, int ii)
|
void InvGetItem(int pnum, Item *item, int ii)
|
||||||
{
|
{
|
||||||
if (dropGoldFlag) {
|
if (dropGoldFlag) {
|
||||||
dropGoldFlag = false;
|
dropGoldFlag = false;
|
||||||
|
|
@ -1617,7 +1617,7 @@ void InvGetItem(int pnum, ItemStruct *item, int ii)
|
||||||
NewCursor(player.HoldItem._iCurs + CURSOR_FIRSTITEM);
|
NewCursor(player.HoldItem._iCurs + CURSOR_FIRSTITEM);
|
||||||
}
|
}
|
||||||
|
|
||||||
void AutoGetItem(int pnum, ItemStruct *item, int ii)
|
void AutoGetItem(int pnum, Item *item, int ii)
|
||||||
{
|
{
|
||||||
bool done;
|
bool done;
|
||||||
|
|
||||||
|
|
@ -1891,7 +1891,7 @@ int8_t CheckInvHLight()
|
||||||
|
|
||||||
int8_t rv = -1;
|
int8_t rv = -1;
|
||||||
InfoColor = UiFlags::ColorSilver;
|
InfoColor = UiFlags::ColorSilver;
|
||||||
ItemStruct *pi = nullptr;
|
Item *pi = nullptr;
|
||||||
auto &myPlayer = Players[MyPlayerId];
|
auto &myPlayer = Players[MyPlayerId];
|
||||||
|
|
||||||
ClearPanel();
|
ClearPanel();
|
||||||
|
|
@ -2033,7 +2033,7 @@ bool UseStaff()
|
||||||
bool UseInvItem(int pnum, int cii)
|
bool UseInvItem(int pnum, int cii)
|
||||||
{
|
{
|
||||||
int c;
|
int c;
|
||||||
ItemStruct *item;
|
Item *item;
|
||||||
|
|
||||||
auto &player = Players[pnum];
|
auto &player = Players[pnum];
|
||||||
|
|
||||||
|
|
|
||||||
16
Source/inv.h
16
Source/inv.h
|
|
@ -86,7 +86,7 @@ extern const Point InvRect[73];
|
||||||
/**
|
/**
|
||||||
* @brief Function type which performs an operation on the given item.
|
* @brief Function type which performs an operation on the given item.
|
||||||
*/
|
*/
|
||||||
using ItemFunc = void (*)(ItemStruct &);
|
using ItemFunc = void (*)(Item &);
|
||||||
|
|
||||||
void FreeInvGFX();
|
void FreeInvGFX();
|
||||||
void InitInv();
|
void InitInv();
|
||||||
|
|
@ -97,11 +97,11 @@ void InitInv();
|
||||||
void DrawInv(const Surface &out);
|
void DrawInv(const Surface &out);
|
||||||
|
|
||||||
void DrawInvBelt(const Surface &out);
|
void DrawInvBelt(const Surface &out);
|
||||||
bool AutoEquipEnabled(const Player &player, const ItemStruct &item);
|
bool AutoEquipEnabled(const Player &player, const Item &item);
|
||||||
bool AutoEquip(int playerId, const ItemStruct &item, bool persistItem = true);
|
bool AutoEquip(int playerId, const Item &item, bool persistItem = true);
|
||||||
bool AutoPlaceItemInInventory(Player &player, const ItemStruct &item, bool persistItem = false);
|
bool AutoPlaceItemInInventory(Player &player, const Item &item, bool persistItem = false);
|
||||||
bool AutoPlaceItemInInventorySlot(Player &player, int slotIndex, const ItemStruct &item, bool persistItem);
|
bool AutoPlaceItemInInventorySlot(Player &player, int slotIndex, const Item &item, bool persistItem);
|
||||||
bool AutoPlaceItemInBelt(Player &player, const ItemStruct &item, bool persistItem = false);
|
bool AutoPlaceItemInBelt(Player &player, const Item &item, bool persistItem = false);
|
||||||
bool GoldAutoPlace(Player &player);
|
bool GoldAutoPlace(Player &player);
|
||||||
bool GoldAutoPlaceInInventorySlot(Player &player, int slotIndex);
|
bool GoldAutoPlaceInInventorySlot(Player &player, int slotIndex);
|
||||||
void CheckInvSwap(Player &player, BYTE bLoc, int idx, uint16_t wCI, int seed, bool bId, uint32_t dwBuff);
|
void CheckInvSwap(Player &player, BYTE bLoc, int idx, uint16_t wCI, int seed, bool bId, uint32_t dwBuff);
|
||||||
|
|
@ -109,8 +109,8 @@ void inv_update_rem_item(Player &player, BYTE iv);
|
||||||
void CheckInvItem(bool isShiftHeld = false);
|
void CheckInvItem(bool isShiftHeld = false);
|
||||||
void CheckInvScrn(bool isShiftHeld);
|
void CheckInvScrn(bool isShiftHeld);
|
||||||
void CheckItemStats(Player &player);
|
void CheckItemStats(Player &player);
|
||||||
void InvGetItem(int pnum, ItemStruct *item, int ii);
|
void InvGetItem(int pnum, Item *item, int ii);
|
||||||
void AutoGetItem(int pnum, ItemStruct *item, int ii);
|
void AutoGetItem(int pnum, Item *item, int ii);
|
||||||
int FindGetItem(int idx, uint16_t ci, int iseed);
|
int FindGetItem(int idx, uint16_t ci, int iseed);
|
||||||
void SyncGetItem(Point position, int idx, uint16_t ci, int iseed);
|
void SyncGetItem(Point position, int idx, uint16_t ci, int iseed);
|
||||||
bool CanPut(Point position);
|
bool CanPut(Point position);
|
||||||
|
|
|
||||||
|
|
@ -20,13 +20,13 @@ public:
|
||||||
public:
|
public:
|
||||||
using iterator_category = std::forward_iterator_tag;
|
using iterator_category = std::forward_iterator_tag;
|
||||||
using difference_type = void;
|
using difference_type = void;
|
||||||
using value_type = ItemStruct;
|
using value_type = Item;
|
||||||
using pointer = value_type *;
|
using pointer = value_type *;
|
||||||
using reference = value_type &;
|
using reference = value_type &;
|
||||||
|
|
||||||
Iterator() = default;
|
Iterator() = default;
|
||||||
|
|
||||||
Iterator(ItemStruct *items, std::size_t count, std::size_t index)
|
Iterator(Item *items, std::size_t count, std::size_t index)
|
||||||
: items_(items)
|
: items_(items)
|
||||||
, count_(count)
|
, count_(count)
|
||||||
, index_(index)
|
, index_(index)
|
||||||
|
|
@ -81,12 +81,12 @@ public:
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
ItemStruct *items_ = nullptr;
|
Item *items_ = nullptr;
|
||||||
std::size_t count_ = 0;
|
std::size_t count_ = 0;
|
||||||
std::size_t index_ = 0;
|
std::size_t index_ = 0;
|
||||||
};
|
};
|
||||||
|
|
||||||
ItemsContainerRange(ItemStruct *items, std::size_t count)
|
ItemsContainerRange(Item *items, std::size_t count)
|
||||||
: items_(items)
|
: items_(items)
|
||||||
, count_(count)
|
, count_(count)
|
||||||
{
|
{
|
||||||
|
|
@ -103,7 +103,7 @@ public:
|
||||||
}
|
}
|
||||||
|
|
||||||
private:
|
private:
|
||||||
ItemStruct *items_;
|
Item *items_;
|
||||||
std::size_t count_;
|
std::size_t count_;
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
@ -116,7 +116,7 @@ public:
|
||||||
public:
|
public:
|
||||||
using iterator_category = std::forward_iterator_tag;
|
using iterator_category = std::forward_iterator_tag;
|
||||||
using difference_type = void;
|
using difference_type = void;
|
||||||
using value_type = ItemStruct;
|
using value_type = Item;
|
||||||
using pointer = value_type *;
|
using pointer = value_type *;
|
||||||
using reference = value_type &;
|
using reference = value_type &;
|
||||||
|
|
||||||
|
|
|
||||||
120
Source/items.cpp
120
Source/items.cpp
|
|
@ -36,7 +36,7 @@
|
||||||
namespace devilution {
|
namespace devilution {
|
||||||
|
|
||||||
/** Contains the items on ground in the current game. */
|
/** Contains the items on ground in the current game. */
|
||||||
ItemStruct Items[MAXITEMS + 1];
|
Item Items[MAXITEMS + 1];
|
||||||
int ActiveItems[MAXITEMS];
|
int ActiveItems[MAXITEMS];
|
||||||
int ActiveItemCount;
|
int ActiveItemCount;
|
||||||
int AvailableItems[MAXITEMS];
|
int AvailableItems[MAXITEMS];
|
||||||
|
|
@ -131,7 +131,7 @@ enum class PlayerArmorGraphic : uint8_t {
|
||||||
// clang-format on
|
// clang-format on
|
||||||
};
|
};
|
||||||
|
|
||||||
ItemStruct curruitem;
|
Item curruitem;
|
||||||
|
|
||||||
/** Holds item get records, tracking items being recently looted. This is in an effort to prevent items being picked up more than once. */
|
/** Holds item get records, tracking items being recently looted. This is in an effort to prevent items being picked up more than once. */
|
||||||
ItemGetRecordStruct itemrecord[MAXITEMS];
|
ItemGetRecordStruct itemrecord[MAXITEMS];
|
||||||
|
|
@ -506,7 +506,7 @@ void CalcSelfItems(Player &player)
|
||||||
} while (changeflag);
|
} while (changeflag);
|
||||||
}
|
}
|
||||||
|
|
||||||
bool ItemMinStats(const Player &player, ItemStruct &x)
|
bool ItemMinStats(const Player &player, Item &x)
|
||||||
{
|
{
|
||||||
if (player._pMagic < x._iMinMag)
|
if (player._pMagic < x._iMinMag)
|
||||||
return false;
|
return false;
|
||||||
|
|
@ -550,7 +550,7 @@ void WitchBookLevel(int ii)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
bool StoreStatOk(ItemStruct &item)
|
bool StoreStatOk(Item &item)
|
||||||
{
|
{
|
||||||
const auto &myPlayer = Players[MyPlayerId];
|
const auto &myPlayer = Players[MyPlayerId];
|
||||||
|
|
||||||
|
|
@ -591,7 +591,7 @@ void CalcPlrBookVals(Player &player)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void SetPlrHandSeed(ItemStruct &item, int iseed)
|
void SetPlrHandSeed(Item &item, int iseed)
|
||||||
{
|
{
|
||||||
item._iSeed = iseed;
|
item._iSeed = iseed;
|
||||||
}
|
}
|
||||||
|
|
@ -666,7 +666,7 @@ void GetSuperItemSpace(Point position, int8_t inum)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void CalcItemValue(ItemStruct &item)
|
void CalcItemValue(Item &item)
|
||||||
{
|
{
|
||||||
int v = item._iVMult1 + item._iVMult2;
|
int v = item._iVMult1 + item._iVMult2;
|
||||||
if (v > 0) {
|
if (v > 0) {
|
||||||
|
|
@ -679,7 +679,7 @@ void CalcItemValue(ItemStruct &item)
|
||||||
item._iIvalue = std::max(v, 1);
|
item._iIvalue = std::max(v, 1);
|
||||||
}
|
}
|
||||||
|
|
||||||
void GetBookSpell(ItemStruct &item, int lvl)
|
void GetBookSpell(Item &item, int lvl)
|
||||||
{
|
{
|
||||||
int rv;
|
int rv;
|
||||||
|
|
||||||
|
|
@ -762,7 +762,7 @@ int CalculateToHitBonus(int level)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
int SaveItemPower(ItemStruct &item, const ItemPower &power)
|
int SaveItemPower(Item &item, const ItemPower &power)
|
||||||
{
|
{
|
||||||
int r = RndPL(power.param1, power.param2);
|
int r = RndPL(power.param1, power.param2);
|
||||||
|
|
||||||
|
|
@ -1133,7 +1133,7 @@ int PLVal(int pv, int p1, int p2, int minv, int maxv)
|
||||||
return minv + (maxv - minv) * (100 * (pv - p1) / (p2 - p1)) / 100;
|
return minv + (maxv - minv) * (100 * (pv - p1) / (p2 - p1)) / 100;
|
||||||
}
|
}
|
||||||
|
|
||||||
void SaveItemAffix(ItemStruct &item, const PLStruct &affix)
|
void SaveItemAffix(Item &item, const PLStruct &affix)
|
||||||
{
|
{
|
||||||
auto power = affix.power;
|
auto power = affix.power;
|
||||||
|
|
||||||
|
|
@ -1156,7 +1156,7 @@ void SaveItemAffix(ItemStruct &item, const PLStruct &affix)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void GetStaffPower(ItemStruct &item, int lvl, int bs, bool onlygood)
|
void GetStaffPower(Item &item, int lvl, int bs, bool onlygood)
|
||||||
{
|
{
|
||||||
int preidx = -1;
|
int preidx = -1;
|
||||||
if (GenerateRnd(10) == 0 || onlygood) {
|
if (GenerateRnd(10) == 0 || onlygood) {
|
||||||
|
|
@ -1199,7 +1199,7 @@ void GetStaffPower(ItemStruct &item, int lvl, int bs, bool onlygood)
|
||||||
CalcItemValue(item);
|
CalcItemValue(item);
|
||||||
}
|
}
|
||||||
|
|
||||||
void GetItemPower(ItemStruct &item, int minlvl, int maxlvl, affix_item_type flgs, bool onlygood)
|
void GetItemPower(Item &item, int minlvl, int maxlvl, affix_item_type flgs, bool onlygood)
|
||||||
{
|
{
|
||||||
int l[256];
|
int l[256];
|
||||||
char istr[128];
|
char istr[128];
|
||||||
|
|
@ -1286,7 +1286,7 @@ void GetItemPower(ItemStruct &item, int minlvl, int maxlvl, affix_item_type flgs
|
||||||
CalcItemValue(item);
|
CalcItemValue(item);
|
||||||
}
|
}
|
||||||
|
|
||||||
void GetStaffSpell(ItemStruct &item, int lvl, bool onlygood)
|
void GetStaffSpell(Item &item, int lvl, bool onlygood)
|
||||||
{
|
{
|
||||||
if (!gbIsHellfire && GenerateRnd(4) == 0) {
|
if (!gbIsHellfire && GenerateRnd(4) == 0) {
|
||||||
GetItemPower(item, lvl / 2, lvl, PLT_STAFF, onlygood);
|
GetItemPower(item, lvl / 2, lvl, PLT_STAFF, onlygood);
|
||||||
|
|
@ -1339,7 +1339,7 @@ void GetStaffSpell(ItemStruct &item, int lvl, bool onlygood)
|
||||||
GetStaffPower(item, lvl, bs, onlygood);
|
GetStaffPower(item, lvl, bs, onlygood);
|
||||||
}
|
}
|
||||||
|
|
||||||
void GetOilType(ItemStruct &item, int maxLvl)
|
void GetOilType(Item &item, int maxLvl)
|
||||||
{
|
{
|
||||||
int cnt = 2;
|
int cnt = 2;
|
||||||
int8_t rnd[32] = { 5, 6 };
|
int8_t rnd[32] = { 5, 6 };
|
||||||
|
|
@ -1366,7 +1366,7 @@ void GetOilType(ItemStruct &item, int maxLvl)
|
||||||
item._iIvalue = OilValues[t];
|
item._iIvalue = OilValues[t];
|
||||||
}
|
}
|
||||||
|
|
||||||
void GetItemBonus(ItemStruct &item, int minlvl, int maxlvl, bool onlygood, bool allowspells)
|
void GetItemBonus(Item &item, int minlvl, int maxlvl, bool onlygood, bool allowspells)
|
||||||
{
|
{
|
||||||
if (minlvl > 25)
|
if (minlvl > 25)
|
||||||
minlvl = 25;
|
minlvl = 25;
|
||||||
|
|
@ -1501,7 +1501,7 @@ int RndTypeItems(int itype, int imid, int lvl)
|
||||||
return ril[GenerateRnd(ri)];
|
return ril[GenerateRnd(ri)];
|
||||||
}
|
}
|
||||||
|
|
||||||
_unique_items CheckUnique(ItemStruct &item, int lvl, int uper, bool recreate)
|
_unique_items CheckUnique(Item &item, int lvl, int uper, bool recreate)
|
||||||
{
|
{
|
||||||
std::bitset<128> uok = {};
|
std::bitset<128> uok = {};
|
||||||
|
|
||||||
|
|
@ -1535,7 +1535,7 @@ _unique_items CheckUnique(ItemStruct &item, int lvl, int uper, bool recreate)
|
||||||
return (_unique_items)itemData;
|
return (_unique_items)itemData;
|
||||||
}
|
}
|
||||||
|
|
||||||
void GetUniqueItem(ItemStruct &item, _unique_items uid)
|
void GetUniqueItem(Item &item, _unique_items uid)
|
||||||
{
|
{
|
||||||
UniqueItemFlags[uid] = true;
|
UniqueItemFlags[uid] = true;
|
||||||
|
|
||||||
|
|
@ -1556,13 +1556,13 @@ void GetUniqueItem(ItemStruct &item, _unique_items uid)
|
||||||
item._iCreateInfo |= CF_UNIQUE;
|
item._iCreateInfo |= CF_UNIQUE;
|
||||||
}
|
}
|
||||||
|
|
||||||
void ItemRndDur(ItemStruct &item)
|
void ItemRndDur(Item &item)
|
||||||
{
|
{
|
||||||
if (item._iDurability > 0 && item._iDurability != DUR_INDESTRUCTIBLE)
|
if (item._iDurability > 0 && item._iDurability != DUR_INDESTRUCTIBLE)
|
||||||
item._iDurability = GenerateRnd(item._iMaxDur / 2) + (item._iMaxDur / 4) + 1;
|
item._iDurability = GenerateRnd(item._iMaxDur / 2) + (item._iMaxDur / 4) + 1;
|
||||||
}
|
}
|
||||||
|
|
||||||
void SetupAllItems(ItemStruct &item, int idx, int iseed, int lvl, int uper, bool onlygood, bool recreate, bool pregen)
|
void SetupAllItems(Item &item, int idx, int iseed, int lvl, int uper, bool onlygood, bool recreate, bool pregen)
|
||||||
{
|
{
|
||||||
int iblvl;
|
int iblvl;
|
||||||
|
|
||||||
|
|
@ -1635,7 +1635,7 @@ void SetupBaseItem(Point position, int idx, bool onlygood, bool sendmsg, bool de
|
||||||
DeltaAddItem(ii);
|
DeltaAddItem(ii);
|
||||||
}
|
}
|
||||||
|
|
||||||
void SetupAllUseful(ItemStruct &item, int iseed, int lvl)
|
void SetupAllUseful(Item &item, int iseed, int lvl)
|
||||||
{
|
{
|
||||||
int idx;
|
int idx;
|
||||||
|
|
||||||
|
|
@ -1735,7 +1735,7 @@ void ItemDoppel()
|
||||||
|
|
||||||
for (int idoppelx = 16; idoppelx < 96; idoppelx++) {
|
for (int idoppelx = 16; idoppelx < 96; idoppelx++) {
|
||||||
if (dItem[idoppelx][idoppely] != 0) {
|
if (dItem[idoppelx][idoppely] != 0) {
|
||||||
ItemStruct *i = &Items[dItem[idoppelx][idoppely] - 1];
|
Item *i = &Items[dItem[idoppelx][idoppely] - 1];
|
||||||
if (i->position.x != idoppelx || i->position.y != idoppely)
|
if (i->position.x != idoppelx || i->position.y != idoppely)
|
||||||
dItem[idoppelx][idoppely] = 0;
|
dItem[idoppelx][idoppely] = 0;
|
||||||
}
|
}
|
||||||
|
|
@ -1746,7 +1746,7 @@ void ItemDoppel()
|
||||||
idoppely = 16;
|
idoppely = 16;
|
||||||
}
|
}
|
||||||
|
|
||||||
void RepairItem(ItemStruct &item, int lvl)
|
void RepairItem(Item &item, int lvl)
|
||||||
{
|
{
|
||||||
if (item._iDurability == item._iMaxDur) {
|
if (item._iDurability == item._iMaxDur) {
|
||||||
return;
|
return;
|
||||||
|
|
@ -1770,7 +1770,7 @@ void RepairItem(ItemStruct &item, int lvl)
|
||||||
item._iDurability = std::min<int>(item._iDurability + rep, item._iMaxDur);
|
item._iDurability = std::min<int>(item._iDurability + rep, item._iMaxDur);
|
||||||
}
|
}
|
||||||
|
|
||||||
void RechargeItem(ItemStruct &item, int r)
|
void RechargeItem(Item &item, int r)
|
||||||
{
|
{
|
||||||
if (item._iCharges == item._iMaxCharges)
|
if (item._iCharges == item._iMaxCharges)
|
||||||
return;
|
return;
|
||||||
|
|
@ -1786,7 +1786,7 @@ void RechargeItem(ItemStruct &item, int r)
|
||||||
item._iCharges = std::min(item._iCharges, item._iMaxCharges);
|
item._iCharges = std::min(item._iCharges, item._iMaxCharges);
|
||||||
}
|
}
|
||||||
|
|
||||||
bool ApplyOilToItem(ItemStruct &item, Player &player)
|
bool ApplyOilToItem(Item &item, Player &player)
|
||||||
{
|
{
|
||||||
int r;
|
int r;
|
||||||
|
|
||||||
|
|
@ -2052,7 +2052,7 @@ void DrawUniqueInfoDevider(const Surface &out, int y)
|
||||||
memcpy(dst, src, 267); // BUGFIX: should be 267 (fixed)
|
memcpy(dst, src, 267); // BUGFIX: should be 267 (fixed)
|
||||||
}
|
}
|
||||||
|
|
||||||
void PrintItemMisc(ItemStruct &item)
|
void PrintItemMisc(Item &item)
|
||||||
{
|
{
|
||||||
if (item._iMiscId == IMISC_SCROLL) {
|
if (item._iMiscId == IMISC_SCROLL) {
|
||||||
strcpy(tempstr, _("Right-click to read"));
|
strcpy(tempstr, _("Right-click to read"));
|
||||||
|
|
@ -2101,7 +2101,7 @@ void PrintItemMisc(ItemStruct &item)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void PrintItemInfo(ItemStruct &item)
|
void PrintItemInfo(Item &item)
|
||||||
{
|
{
|
||||||
PrintItemMisc(item);
|
PrintItemMisc(item);
|
||||||
uint8_t str = item._iMinStr;
|
uint8_t str = item._iMinStr;
|
||||||
|
|
@ -2173,13 +2173,13 @@ int RndSmithItem(int lvl)
|
||||||
return RndVendorItem<SmithItemOk, true>(0, lvl);
|
return RndVendorItem<SmithItemOk, true>(0, lvl);
|
||||||
}
|
}
|
||||||
|
|
||||||
void SortVendor(ItemStruct *itemList)
|
void SortVendor(Item *itemList)
|
||||||
{
|
{
|
||||||
int count = 1;
|
int count = 1;
|
||||||
while (!itemList[count].isEmpty())
|
while (!itemList[count].isEmpty())
|
||||||
count++;
|
count++;
|
||||||
|
|
||||||
auto cmp = [](const ItemStruct &a, const ItemStruct &b) {
|
auto cmp = [](const Item &a, const Item &b) {
|
||||||
return a.IDidx < b.IDidx;
|
return a.IDidx < b.IDidx;
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
@ -2216,7 +2216,7 @@ void SpawnOnePremium(int i, int plvl, int playerId)
|
||||||
{
|
{
|
||||||
int itemValue = 0;
|
int itemValue = 0;
|
||||||
bool keepGoing = false;
|
bool keepGoing = false;
|
||||||
ItemStruct tempItem = Items[0];
|
Item tempItem = Items[0];
|
||||||
|
|
||||||
auto &player = Players[playerId];
|
auto &player = Players[playerId];
|
||||||
|
|
||||||
|
|
@ -2253,7 +2253,7 @@ void SpawnOnePremium(int i, int plvl, int playerId)
|
||||||
case ITYPE_MARMOR:
|
case ITYPE_MARMOR:
|
||||||
case ITYPE_HARMOR: {
|
case ITYPE_HARMOR: {
|
||||||
const auto *const mostValuablePlayerArmor = player.GetMostValuableItem(
|
const auto *const mostValuablePlayerArmor = player.GetMostValuableItem(
|
||||||
[](const ItemStruct &item) {
|
[](const Item &item) {
|
||||||
return item._itype == ITYPE_LARMOR
|
return item._itype == ITYPE_LARMOR
|
||||||
|| item._itype == ITYPE_MARMOR
|
|| item._itype == ITYPE_MARMOR
|
||||||
|| item._itype == ITYPE_HARMOR;
|
|| item._itype == ITYPE_HARMOR;
|
||||||
|
|
@ -2272,7 +2272,7 @@ void SpawnOnePremium(int i, int plvl, int playerId)
|
||||||
case ITYPE_RING:
|
case ITYPE_RING:
|
||||||
case ITYPE_AMULET: {
|
case ITYPE_AMULET: {
|
||||||
const auto *const mostValuablePlayerItem = player.GetMostValuableItem(
|
const auto *const mostValuablePlayerItem = player.GetMostValuableItem(
|
||||||
[](const ItemStruct &item) { return item._itype == Items[0]._itype; });
|
[](const Item &item) { return item._itype == Items[0]._itype; });
|
||||||
|
|
||||||
itemValue = mostValuablePlayerItem == nullptr ? 0 : mostValuablePlayerItem->_iIvalue;
|
itemValue = mostValuablePlayerItem == nullptr ? 0 : mostValuablePlayerItem->_iIvalue;
|
||||||
break;
|
break;
|
||||||
|
|
@ -2369,7 +2369,7 @@ int RndHealerItem(int lvl)
|
||||||
return RndVendorItem<HealerItemOk>(0, lvl);
|
return RndVendorItem<HealerItemOk>(0, lvl);
|
||||||
}
|
}
|
||||||
|
|
||||||
void RecreateSmithItem(ItemStruct &item, int lvl, int iseed)
|
void RecreateSmithItem(Item &item, int lvl, int iseed)
|
||||||
{
|
{
|
||||||
SetRndSeed(iseed);
|
SetRndSeed(iseed);
|
||||||
int itype = RndSmithItem(lvl) - 1;
|
int itype = RndSmithItem(lvl) - 1;
|
||||||
|
|
@ -2380,7 +2380,7 @@ void RecreateSmithItem(ItemStruct &item, int lvl, int iseed)
|
||||||
item._iIdentified = true;
|
item._iIdentified = true;
|
||||||
}
|
}
|
||||||
|
|
||||||
void RecreatePremiumItem(ItemStruct &item, int plvl, int iseed)
|
void RecreatePremiumItem(Item &item, int plvl, int iseed)
|
||||||
{
|
{
|
||||||
SetRndSeed(iseed);
|
SetRndSeed(iseed);
|
||||||
int itype = RndPremiumItem(plvl / 4, plvl) - 1;
|
int itype = RndPremiumItem(plvl / 4, plvl) - 1;
|
||||||
|
|
@ -2392,7 +2392,7 @@ void RecreatePremiumItem(ItemStruct &item, int plvl, int iseed)
|
||||||
item._iIdentified = true;
|
item._iIdentified = true;
|
||||||
}
|
}
|
||||||
|
|
||||||
void RecreateBoyItem(ItemStruct &item, int lvl, int iseed)
|
void RecreateBoyItem(Item &item, int lvl, int iseed)
|
||||||
{
|
{
|
||||||
SetRndSeed(iseed);
|
SetRndSeed(iseed);
|
||||||
int itype = RndBoyItem(lvl) - 1;
|
int itype = RndBoyItem(lvl) - 1;
|
||||||
|
|
@ -2404,7 +2404,7 @@ void RecreateBoyItem(ItemStruct &item, int lvl, int iseed)
|
||||||
item._iIdentified = true;
|
item._iIdentified = true;
|
||||||
}
|
}
|
||||||
|
|
||||||
void RecreateWitchItem(ItemStruct &item, int idx, int lvl, int iseed)
|
void RecreateWitchItem(Item &item, int idx, int lvl, int iseed)
|
||||||
{
|
{
|
||||||
if (idx == IDI_MANA || idx == IDI_FULLMANA || idx == IDI_PORTAL) {
|
if (idx == IDI_MANA || idx == IDI_FULLMANA || idx == IDI_PORTAL) {
|
||||||
GetItemAttrs(item, idx, lvl);
|
GetItemAttrs(item, idx, lvl);
|
||||||
|
|
@ -2430,7 +2430,7 @@ void RecreateWitchItem(ItemStruct &item, int idx, int lvl, int iseed)
|
||||||
item._iIdentified = true;
|
item._iIdentified = true;
|
||||||
}
|
}
|
||||||
|
|
||||||
void RecreateHealerItem(ItemStruct &item, int idx, int lvl, int iseed)
|
void RecreateHealerItem(Item &item, int idx, int lvl, int iseed)
|
||||||
{
|
{
|
||||||
if (idx == IDI_HEAL || idx == IDI_FULLHEAL || idx == IDI_RESURRECT) {
|
if (idx == IDI_HEAL || idx == IDI_FULLHEAL || idx == IDI_RESURRECT) {
|
||||||
GetItemAttrs(item, idx, lvl);
|
GetItemAttrs(item, idx, lvl);
|
||||||
|
|
@ -2445,7 +2445,7 @@ void RecreateHealerItem(ItemStruct &item, int idx, int lvl, int iseed)
|
||||||
item._iIdentified = true;
|
item._iIdentified = true;
|
||||||
}
|
}
|
||||||
|
|
||||||
void RecreateTownItem(ItemStruct &item, int idx, uint16_t icreateinfo, int iseed)
|
void RecreateTownItem(Item &item, int idx, uint16_t icreateinfo, int iseed)
|
||||||
{
|
{
|
||||||
if ((icreateinfo & CF_SMITH) != 0)
|
if ((icreateinfo & CF_SMITH) != 0)
|
||||||
RecreateSmithItem(item, icreateinfo & CF_LEVEL, iseed);
|
RecreateSmithItem(item, icreateinfo & CF_LEVEL, iseed);
|
||||||
|
|
@ -2552,7 +2552,7 @@ bool IsItemAvailable(int i)
|
||||||
sgOptions.Gameplay.bTestBard && (i == IDI_BARDSWORD || i == IDI_BARDDAGGER));
|
sgOptions.Gameplay.bTestBard && (i == IDI_BARDSWORD || i == IDI_BARDDAGGER));
|
||||||
}
|
}
|
||||||
|
|
||||||
BYTE GetOutlineColor(const ItemStruct &item, bool checkReq)
|
BYTE GetOutlineColor(const Item &item, bool checkReq)
|
||||||
{
|
{
|
||||||
if (checkReq && !item._iStatFlag)
|
if (checkReq && !item._iStatFlag)
|
||||||
return ICOL_RED;
|
return ICOL_RED;
|
||||||
|
|
@ -3004,7 +3004,7 @@ void CalcPlrInv(Player &player, bool loadgfx)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void SetPlrHandItem(ItemStruct &item, int itemData)
|
void SetPlrHandItem(Item &item, int itemData)
|
||||||
{
|
{
|
||||||
auto &pAllItem = AllItemsList[itemData];
|
auto &pAllItem = AllItemsList[itemData];
|
||||||
|
|
||||||
|
|
@ -3043,12 +3043,12 @@ void SetPlrHandItem(ItemStruct &item, int itemData)
|
||||||
item.dwBuff |= CF_HELLFIRE;
|
item.dwBuff |= CF_HELLFIRE;
|
||||||
}
|
}
|
||||||
|
|
||||||
void GetPlrHandSeed(ItemStruct *h)
|
void GetPlrHandSeed(Item *h)
|
||||||
{
|
{
|
||||||
h->_iSeed = AdvanceRndSeed();
|
h->_iSeed = AdvanceRndSeed();
|
||||||
}
|
}
|
||||||
|
|
||||||
void SetGoldSeed(Player &player, ItemStruct &gold)
|
void SetGoldSeed(Player &player, Item &gold)
|
||||||
{
|
{
|
||||||
int s = 0;
|
int s = 0;
|
||||||
|
|
||||||
|
|
@ -3088,7 +3088,7 @@ int GetGoldCursor(int value)
|
||||||
* @brief Update the gold cursor on the given gold item
|
* @brief Update the gold cursor on the given gold item
|
||||||
* @param h The item to update
|
* @param h The item to update
|
||||||
*/
|
*/
|
||||||
void SetPlrHandGoldCurs(ItemStruct &gold)
|
void SetPlrHandGoldCurs(Item &gold)
|
||||||
{
|
{
|
||||||
gold._iCurs = GetGoldCursor(gold._ivalue);
|
gold._iCurs = GetGoldCursor(gold._ivalue);
|
||||||
}
|
}
|
||||||
|
|
@ -3269,7 +3269,7 @@ Point GetSuperItemLoc(Point position)
|
||||||
return { 0, 0 }; // TODO handle no space for dropping items
|
return { 0, 0 }; // TODO handle no space for dropping items
|
||||||
}
|
}
|
||||||
|
|
||||||
void GetItemAttrs(ItemStruct &item, int itemData, int lvl)
|
void GetItemAttrs(Item &item, int itemData, int lvl)
|
||||||
{
|
{
|
||||||
item._itype = AllItemsList[itemData].itype;
|
item._itype = AllItemsList[itemData].itype;
|
||||||
item._iCurs = AllItemsList[itemData].iCurs;
|
item._iCurs = AllItemsList[itemData].iCurs;
|
||||||
|
|
@ -3326,7 +3326,7 @@ void GetItemAttrs(ItemStruct &item, int itemData, int lvl)
|
||||||
SetPlrHandGoldCurs(item);
|
SetPlrHandGoldCurs(item);
|
||||||
}
|
}
|
||||||
|
|
||||||
void SetupItem(ItemStruct &item)
|
void SetupItem(Item &item)
|
||||||
{
|
{
|
||||||
item.SetNewAnimation(Players[MyPlayerId].pLvlLoad == 0);
|
item.SetNewAnimation(Players[MyPlayerId].pLvlLoad == 0);
|
||||||
item._iIdentified = false;
|
item._iIdentified = false;
|
||||||
|
|
@ -3473,7 +3473,7 @@ void CreateTypeItem(Point position, bool onlygood, int itype, int imisc, bool se
|
||||||
SetupBaseItem(position, idx, onlygood, sendmsg, delta);
|
SetupBaseItem(position, idx, onlygood, sendmsg, delta);
|
||||||
}
|
}
|
||||||
|
|
||||||
void RecreateItem(ItemStruct &item, int idx, uint16_t icreateinfo, int iseed, int ivalue, bool isHellfire)
|
void RecreateItem(Item &item, int idx, uint16_t icreateinfo, int iseed, int ivalue, bool isHellfire)
|
||||||
{
|
{
|
||||||
bool tmpIsHellfire = gbIsHellfire;
|
bool tmpIsHellfire = gbIsHellfire;
|
||||||
gbIsHellfire = isHellfire;
|
gbIsHellfire = isHellfire;
|
||||||
|
|
@ -3525,7 +3525,7 @@ void RecreateItem(ItemStruct &item, int idx, uint16_t icreateinfo, int iseed, in
|
||||||
gbIsHellfire = tmpIsHellfire;
|
gbIsHellfire = tmpIsHellfire;
|
||||||
}
|
}
|
||||||
|
|
||||||
void RecreateEar(ItemStruct &item, uint16_t ic, int iseed, int id, int dur, int mdur, int ch, int mch, int ivalue, int ibuff)
|
void RecreateEar(Item &item, uint16_t ic, int iseed, int id, int dur, int mdur, int ch, int mch, int ivalue, int ibuff)
|
||||||
{
|
{
|
||||||
SetPlrHandItem(item, IDI_EAR);
|
SetPlrHandItem(item, IDI_EAR);
|
||||||
tempstr[0] = static_cast<char>((ic >> 8) & 0x7F);
|
tempstr[0] = static_cast<char>((ic >> 8) & 0x7F);
|
||||||
|
|
@ -3685,7 +3685,7 @@ void SpawnTheodore(Point position)
|
||||||
SpawnRewardItem(IDI_THEODORE, position);
|
SpawnRewardItem(IDI_THEODORE, position);
|
||||||
}
|
}
|
||||||
|
|
||||||
void RespawnItem(ItemStruct *item, bool flipFlag)
|
void RespawnItem(Item *item, bool flipFlag)
|
||||||
{
|
{
|
||||||
int it = ItemCAnimTbl[item->_iCurs];
|
int it = ItemCAnimTbl[item->_iCurs];
|
||||||
item->SetNewAnimation(flipFlag);
|
item->SetNewAnimation(flipFlag);
|
||||||
|
|
@ -3745,12 +3745,12 @@ void FreeItemGFX()
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void GetItemFrm(ItemStruct &item)
|
void GetItemFrm(Item &item)
|
||||||
{
|
{
|
||||||
item.AnimInfo.pCelSprite = &*itemanims[ItemCAnimTbl[item._iCurs]];
|
item.AnimInfo.pCelSprite = &*itemanims[ItemCAnimTbl[item._iCurs]];
|
||||||
}
|
}
|
||||||
|
|
||||||
void GetItemStr(ItemStruct &item)
|
void GetItemStr(Item &item)
|
||||||
{
|
{
|
||||||
if (item._itype != ITYPE_GOLD) {
|
if (item._itype != ITYPE_GOLD) {
|
||||||
if (item._iIdentified)
|
if (item._iIdentified)
|
||||||
|
|
@ -3767,7 +3767,7 @@ void GetItemStr(ItemStruct &item)
|
||||||
|
|
||||||
void CheckIdentify(Player &player, int cii)
|
void CheckIdentify(Player &player, int cii)
|
||||||
{
|
{
|
||||||
ItemStruct *pi;
|
Item *pi;
|
||||||
|
|
||||||
if (cii >= NUM_INVLOC)
|
if (cii >= NUM_INVLOC)
|
||||||
pi = &player.InvList[cii - NUM_INVLOC];
|
pi = &player.InvList[cii - NUM_INVLOC];
|
||||||
|
|
@ -3783,7 +3783,7 @@ void CheckIdentify(Player &player, int cii)
|
||||||
|
|
||||||
void DoRepair(Player &player, int cii)
|
void DoRepair(Player &player, int cii)
|
||||||
{
|
{
|
||||||
ItemStruct *pi;
|
Item *pi;
|
||||||
|
|
||||||
PlaySfxLoc(IS_REPAIR, player.position.tile);
|
PlaySfxLoc(IS_REPAIR, player.position.tile);
|
||||||
|
|
||||||
|
|
@ -3802,7 +3802,7 @@ void DoRepair(Player &player, int cii)
|
||||||
|
|
||||||
void DoRecharge(Player &player, int cii)
|
void DoRecharge(Player &player, int cii)
|
||||||
{
|
{
|
||||||
ItemStruct *pi;
|
Item *pi;
|
||||||
|
|
||||||
if (cii >= NUM_INVLOC) {
|
if (cii >= NUM_INVLOC) {
|
||||||
pi = &player.InvList[cii - NUM_INVLOC];
|
pi = &player.InvList[cii - NUM_INVLOC];
|
||||||
|
|
@ -3822,7 +3822,7 @@ void DoRecharge(Player &player, int cii)
|
||||||
|
|
||||||
void DoOil(Player &player, int cii)
|
void DoOil(Player &player, int cii)
|
||||||
{
|
{
|
||||||
ItemStruct *pi;
|
Item *pi;
|
||||||
if (cii >= NUM_INVLOC) {
|
if (cii >= NUM_INVLOC) {
|
||||||
pi = &player.InvList[cii - NUM_INVLOC];
|
pi = &player.InvList[cii - NUM_INVLOC];
|
||||||
} else {
|
} else {
|
||||||
|
|
@ -3835,7 +3835,7 @@ void DoOil(Player &player, int cii)
|
||||||
NewCursor(CURSOR_HAND);
|
NewCursor(CURSOR_HAND);
|
||||||
}
|
}
|
||||||
|
|
||||||
void PrintItemPower(char plidx, ItemStruct *x)
|
void PrintItemPower(char plidx, Item *x)
|
||||||
{
|
{
|
||||||
switch (plidx) {
|
switch (plidx) {
|
||||||
case IPL_TOHIT:
|
case IPL_TOHIT:
|
||||||
|
|
@ -4149,7 +4149,7 @@ void DrawUniqueInfo(const Surface &out)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void PrintItemDetails(ItemStruct *x)
|
void PrintItemDetails(Item *x)
|
||||||
{
|
{
|
||||||
if (x->_iClass == ICLASS_WEAPON) {
|
if (x->_iClass == ICLASS_WEAPON) {
|
||||||
if (x->_iMinDam == x->_iMaxDam) {
|
if (x->_iMinDam == x->_iMaxDam) {
|
||||||
|
|
@ -4196,7 +4196,7 @@ void PrintItemDetails(ItemStruct *x)
|
||||||
PrintItemInfo(*x);
|
PrintItemInfo(*x);
|
||||||
}
|
}
|
||||||
|
|
||||||
void PrintItemDur(ItemStruct *x)
|
void PrintItemDur(Item *x)
|
||||||
{
|
{
|
||||||
if (x->_iClass == ICLASS_WEAPON) {
|
if (x->_iClass == ICLASS_WEAPON) {
|
||||||
if (x->_iMinDam == x->_iMaxDam) {
|
if (x->_iMinDam == x->_iMaxDam) {
|
||||||
|
|
@ -4443,7 +4443,7 @@ void SpawnSmith(int lvl)
|
||||||
{
|
{
|
||||||
constexpr int PinnedItemCount = 0;
|
constexpr int PinnedItemCount = 0;
|
||||||
|
|
||||||
ItemStruct holditem;
|
Item holditem;
|
||||||
holditem = Items[0];
|
holditem = Items[0];
|
||||||
|
|
||||||
int maxValue = 140000;
|
int maxValue = 140000;
|
||||||
|
|
@ -4631,7 +4631,7 @@ void SpawnBoy(int lvl)
|
||||||
case ITYPE_MARMOR:
|
case ITYPE_MARMOR:
|
||||||
case ITYPE_HARMOR: {
|
case ITYPE_HARMOR: {
|
||||||
const auto *const mostValuablePlayerArmor = myPlayer.GetMostValuableItem(
|
const auto *const mostValuablePlayerArmor = myPlayer.GetMostValuableItem(
|
||||||
[](const ItemStruct &item) {
|
[](const Item &item) {
|
||||||
return item._itype == ITYPE_LARMOR
|
return item._itype == ITYPE_LARMOR
|
||||||
|| item._itype == ITYPE_MARMOR
|
|| item._itype == ITYPE_MARMOR
|
||||||
|| item._itype == ITYPE_HARMOR;
|
|| item._itype == ITYPE_HARMOR;
|
||||||
|
|
@ -4650,7 +4650,7 @@ void SpawnBoy(int lvl)
|
||||||
case ITYPE_RING:
|
case ITYPE_RING:
|
||||||
case ITYPE_AMULET: {
|
case ITYPE_AMULET: {
|
||||||
const auto *const mostValuablePlayerItem = myPlayer.GetMostValuableItem(
|
const auto *const mostValuablePlayerItem = myPlayer.GetMostValuableItem(
|
||||||
[itemType](const ItemStruct &item) { return item._itype == itemType; });
|
[itemType](const Item &item) { return item._itype == itemType; });
|
||||||
|
|
||||||
ivalue = mostValuablePlayerItem == nullptr ? 0 : mostValuablePlayerItem->_iIvalue;
|
ivalue = mostValuablePlayerItem == nullptr ? 0 : mostValuablePlayerItem->_iIvalue;
|
||||||
break;
|
break;
|
||||||
|
|
@ -4905,7 +4905,7 @@ std::string DebugSpawnItem(std::string itemName, bool unique)
|
||||||
int uper = (unique ? 15 : 1);
|
int uper = (unique ? 15 : 1);
|
||||||
|
|
||||||
Point bkp = item.position;
|
Point bkp = item.position;
|
||||||
memset(&item, 0, sizeof(ItemStruct));
|
memset(&item, 0, sizeof(Item));
|
||||||
item.position = bkp;
|
item.position = bkp;
|
||||||
memset(UniqueItemFlags, 0, sizeof(UniqueItemFlags));
|
memset(UniqueItemFlags, 0, sizeof(UniqueItemFlags));
|
||||||
SetupAllItems(item, idx, AdvanceRndSeed(), fake_m.mLevel, uper, onlygood, false, false);
|
SetupAllItems(item, idx, AdvanceRndSeed(), fake_m.mLevel, uper, onlygood, false, false);
|
||||||
|
|
@ -4926,7 +4926,7 @@ std::string DebugSpawnItem(std::string itemName, bool unique)
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
void ItemStruct::SetNewAnimation(bool showAnimation)
|
void Item::SetNewAnimation(bool showAnimation)
|
||||||
{
|
{
|
||||||
int it = ItemCAnimTbl[_iCurs];
|
int it = ItemCAnimTbl[_iCurs];
|
||||||
int numberOfFrames = ItemAnimLs[it];
|
int numberOfFrames = ItemAnimLs[it];
|
||||||
|
|
|
||||||
|
|
@ -171,7 +171,7 @@ enum icreateinfo_flag2 {
|
||||||
// All item animation frames have this width.
|
// All item animation frames have this width.
|
||||||
constexpr int ItemAnimWidth = 96;
|
constexpr int ItemAnimWidth = 96;
|
||||||
|
|
||||||
struct ItemStruct {
|
struct Item {
|
||||||
/** Randomly generated identifier */
|
/** Randomly generated identifier */
|
||||||
int32_t _iSeed;
|
int32_t _iSeed;
|
||||||
uint16_t _iCreateInfo;
|
uint16_t _iCreateInfo;
|
||||||
|
|
@ -393,12 +393,12 @@ struct ItemGetRecordStruct {
|
||||||
struct CornerStoneStruct {
|
struct CornerStoneStruct {
|
||||||
Point position;
|
Point position;
|
||||||
bool activated;
|
bool activated;
|
||||||
ItemStruct item;
|
Item item;
|
||||||
};
|
};
|
||||||
|
|
||||||
struct Player;
|
struct Player;
|
||||||
|
|
||||||
extern ItemStruct Items[MAXITEMS + 1];
|
extern Item Items[MAXITEMS + 1];
|
||||||
extern int ActiveItems[MAXITEMS];
|
extern int ActiveItems[MAXITEMS];
|
||||||
extern int ActiveItemCount;
|
extern int ActiveItemCount;
|
||||||
extern int AvailableItems[MAXITEMS];
|
extern int AvailableItems[MAXITEMS];
|
||||||
|
|
@ -406,35 +406,35 @@ extern bool ShowUniqueItemInfoBox;
|
||||||
extern CornerStoneStruct CornerStone;
|
extern CornerStoneStruct CornerStone;
|
||||||
extern bool UniqueItemFlags[128];
|
extern bool UniqueItemFlags[128];
|
||||||
|
|
||||||
BYTE GetOutlineColor(const ItemStruct &item, bool checkReq);
|
BYTE GetOutlineColor(const Item &item, bool checkReq);
|
||||||
bool IsItemAvailable(int i);
|
bool IsItemAvailable(int i);
|
||||||
bool IsUniqueAvailable(int i);
|
bool IsUniqueAvailable(int i);
|
||||||
void InitItemGFX();
|
void InitItemGFX();
|
||||||
void InitItems();
|
void InitItems();
|
||||||
void CalcPlrItemVals(Player &player, bool Loadgfx);
|
void CalcPlrItemVals(Player &player, bool Loadgfx);
|
||||||
void CalcPlrInv(Player &player, bool Loadgfx);
|
void CalcPlrInv(Player &player, bool Loadgfx);
|
||||||
void SetPlrHandItem(ItemStruct &item, int itemData);
|
void SetPlrHandItem(Item &item, int itemData);
|
||||||
void GetPlrHandSeed(ItemStruct *h);
|
void GetPlrHandSeed(Item *h);
|
||||||
/**
|
/**
|
||||||
* @brief Set a new unique seed value on the given item
|
* @brief Set a new unique seed value on the given item
|
||||||
*/
|
*/
|
||||||
void SetGoldSeed(Player &player, ItemStruct &gold);
|
void SetGoldSeed(Player &player, Item &gold);
|
||||||
int GetGoldCursor(int value);
|
int GetGoldCursor(int value);
|
||||||
void SetPlrHandGoldCurs(ItemStruct &gold);
|
void SetPlrHandGoldCurs(Item &gold);
|
||||||
void CreatePlrItems(int playerId);
|
void CreatePlrItems(int playerId);
|
||||||
bool ItemSpaceOk(Point position);
|
bool ItemSpaceOk(Point position);
|
||||||
int AllocateItem();
|
int AllocateItem();
|
||||||
Point GetSuperItemLoc(Point position);
|
Point GetSuperItemLoc(Point position);
|
||||||
void GetItemAttrs(ItemStruct &item, int itemData, int lvl);
|
void GetItemAttrs(Item &item, int itemData, int lvl);
|
||||||
void SetupItem(ItemStruct &item);
|
void SetupItem(Item &item);
|
||||||
int RndItem(const MonsterStruct &monster);
|
int RndItem(const MonsterStruct &monster);
|
||||||
void SpawnUnique(_unique_items uid, Point position);
|
void SpawnUnique(_unique_items uid, Point position);
|
||||||
void SpawnItem(MonsterStruct &monster, Point position, bool sendmsg);
|
void SpawnItem(MonsterStruct &monster, Point position, bool sendmsg);
|
||||||
void CreateRndItem(Point position, bool onlygood, bool sendmsg, bool delta);
|
void CreateRndItem(Point position, bool onlygood, bool sendmsg, bool delta);
|
||||||
void CreateRndUseful(Point position, bool sendmsg);
|
void CreateRndUseful(Point position, bool sendmsg);
|
||||||
void CreateTypeItem(Point position, bool onlygood, int itype, int imisc, bool sendmsg, bool delta);
|
void CreateTypeItem(Point position, bool onlygood, int itype, int imisc, bool sendmsg, bool delta);
|
||||||
void RecreateItem(ItemStruct &item, int idx, uint16_t icreateinfo, int iseed, int ivalue, bool isHellfire);
|
void RecreateItem(Item &item, int idx, uint16_t icreateinfo, int iseed, int ivalue, bool isHellfire);
|
||||||
void RecreateEar(ItemStruct &item, uint16_t ic, int iseed, int Id, int dur, int mdur, int ch, int mch, int ivalue, int ibuff);
|
void RecreateEar(Item &item, uint16_t ic, int iseed, int Id, int dur, int mdur, int ch, int mch, int ivalue, int ibuff);
|
||||||
void CornerstoneSave();
|
void CornerstoneSave();
|
||||||
void CornerstoneLoad(Point position);
|
void CornerstoneLoad(Point position);
|
||||||
void SpawnQuestItem(int itemid, Point position, int randarea, int selflag);
|
void SpawnQuestItem(int itemid, Point position, int randarea, int selflag);
|
||||||
|
|
@ -442,20 +442,20 @@ void SpawnRewardItem(int itemid, Point position);
|
||||||
void SpawnMapOfDoom(Point position);
|
void SpawnMapOfDoom(Point position);
|
||||||
void SpawnRuneBomb(Point position);
|
void SpawnRuneBomb(Point position);
|
||||||
void SpawnTheodore(Point position);
|
void SpawnTheodore(Point position);
|
||||||
void RespawnItem(ItemStruct *item, bool FlipFlag);
|
void RespawnItem(Item *item, bool FlipFlag);
|
||||||
void DeleteItem(int ii, int i);
|
void DeleteItem(int ii, int i);
|
||||||
void ProcessItems();
|
void ProcessItems();
|
||||||
void FreeItemGFX();
|
void FreeItemGFX();
|
||||||
void GetItemFrm(ItemStruct &item);
|
void GetItemFrm(Item &item);
|
||||||
void GetItemStr(ItemStruct &item);
|
void GetItemStr(Item &item);
|
||||||
void CheckIdentify(Player &player, int cii);
|
void CheckIdentify(Player &player, int cii);
|
||||||
void DoRepair(Player &player, int cii);
|
void DoRepair(Player &player, int cii);
|
||||||
void DoRecharge(Player &player, int cii);
|
void DoRecharge(Player &player, int cii);
|
||||||
void DoOil(Player &player, int cii);
|
void DoOil(Player &player, int cii);
|
||||||
void PrintItemPower(char plidx, ItemStruct *x);
|
void PrintItemPower(char plidx, Item *x);
|
||||||
void DrawUniqueInfo(const Surface &out);
|
void DrawUniqueInfo(const Surface &out);
|
||||||
void PrintItemDetails(ItemStruct *x);
|
void PrintItemDetails(Item *x);
|
||||||
void PrintItemDur(ItemStruct *x);
|
void PrintItemDur(Item *x);
|
||||||
void UseItem(int p, item_misc_id Mid, spell_id spl);
|
void UseItem(int p, item_misc_id Mid, spell_id spl);
|
||||||
void SpawnSmith(int lvl);
|
void SpawnSmith(int lvl);
|
||||||
void SpawnPremium(int pnum);
|
void SpawnPremium(int pnum);
|
||||||
|
|
|
||||||
|
|
@ -207,7 +207,7 @@ public:
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
void LoadItemData(LoadHelper *file, ItemStruct *pItem)
|
void LoadItemData(LoadHelper *file, Item *pItem)
|
||||||
{
|
{
|
||||||
pItem->_iSeed = file->NextLE<int32_t>();
|
pItem->_iSeed = file->NextLE<int32_t>();
|
||||||
pItem->_iCreateInfo = file->NextLE<uint16_t>();
|
pItem->_iCreateInfo = file->NextLE<uint16_t>();
|
||||||
|
|
@ -297,7 +297,7 @@ void LoadItemData(LoadHelper *file, ItemStruct *pItem)
|
||||||
RemoveInvalidItem(pItem);
|
RemoveInvalidItem(pItem);
|
||||||
}
|
}
|
||||||
|
|
||||||
void LoadItems(LoadHelper *file, const int n, ItemStruct *pItem)
|
void LoadItems(LoadHelper *file, const int n, Item *pItem)
|
||||||
{
|
{
|
||||||
for (int i = 0; i < n; i++) {
|
for (int i = 0; i < n; i++) {
|
||||||
LoadItemData(file, &pItem[i]);
|
LoadItemData(file, &pItem[i]);
|
||||||
|
|
@ -843,9 +843,9 @@ void ConvertLevels()
|
||||||
leveltype = tmpLeveltype;
|
leveltype = tmpLeveltype;
|
||||||
}
|
}
|
||||||
|
|
||||||
void LoadMatchingItems(LoadHelper *file, const int n, ItemStruct *pItem)
|
void LoadMatchingItems(LoadHelper *file, const int n, Item *pItem)
|
||||||
{
|
{
|
||||||
ItemStruct tempItem;
|
Item tempItem;
|
||||||
|
|
||||||
for (int i = 0; i < n; i++) {
|
for (int i = 0; i < n; i++) {
|
||||||
LoadItemData(file, &tempItem);
|
LoadItemData(file, &tempItem);
|
||||||
|
|
@ -869,7 +869,7 @@ void RemoveEmptyLevelItems()
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void SaveItem(SaveHelper *file, ItemStruct *pItem)
|
void SaveItem(SaveHelper *file, Item *pItem)
|
||||||
{
|
{
|
||||||
auto idx = pItem->IDidx;
|
auto idx = pItem->IDidx;
|
||||||
if (!gbIsHellfire)
|
if (!gbIsHellfire)
|
||||||
|
|
@ -962,7 +962,7 @@ void SaveItem(SaveHelper *file, ItemStruct *pItem)
|
||||||
file->WriteLE<uint32_t>(pItem->_iDamAcFlags);
|
file->WriteLE<uint32_t>(pItem->_iDamAcFlags);
|
||||||
}
|
}
|
||||||
|
|
||||||
void SaveItems(SaveHelper *file, ItemStruct *pItem, const int n)
|
void SaveItems(SaveHelper *file, Item *pItem, const int n)
|
||||||
{
|
{
|
||||||
for (int i = 0; i < n; i++) {
|
for (int i = 0; i < n; i++) {
|
||||||
SaveItem(file, &pItem[i]);
|
SaveItem(file, &pItem[i]);
|
||||||
|
|
@ -1438,7 +1438,7 @@ const int HellfireItemSaveSize = 372;
|
||||||
|
|
||||||
} // namespace
|
} // namespace
|
||||||
|
|
||||||
void RemoveInvalidItem(ItemStruct *pItem)
|
void RemoveInvalidItem(Item *pItem)
|
||||||
{
|
{
|
||||||
bool isInvalid = !IsItemAvailable(pItem->IDidx) || !IsUniqueAvailable(pItem->_iUid);
|
bool isInvalid = !IsItemAvailable(pItem->IDidx) || !IsUniqueAvailable(pItem->_iUid);
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -12,7 +12,7 @@ namespace devilution {
|
||||||
extern bool gbIsHellfireSaveGame;
|
extern bool gbIsHellfireSaveGame;
|
||||||
extern uint8_t giNumberOfLevels;
|
extern uint8_t giNumberOfLevels;
|
||||||
|
|
||||||
void RemoveInvalidItem(ItemStruct *pItem);
|
void RemoveInvalidItem(Item *pItem);
|
||||||
_item_indexes RemapItemIdxFromDiablo(_item_indexes i);
|
_item_indexes RemapItemIdxFromDiablo(_item_indexes i);
|
||||||
_item_indexes RemapItemIdxToDiablo(_item_indexes i);
|
_item_indexes RemapItemIdxToDiablo(_item_indexes i);
|
||||||
_item_indexes RemapItemIdxFromSpawn(_item_indexes i);
|
_item_indexes RemapItemIdxFromSpawn(_item_indexes i);
|
||||||
|
|
|
||||||
|
|
@ -236,7 +236,7 @@ struct TCmdPItem {
|
||||||
uint16_t wCI;
|
uint16_t wCI;
|
||||||
/**
|
/**
|
||||||
* Item identifier
|
* Item identifier
|
||||||
* @see ItemStruct::_iSeed
|
* @see Item::_iSeed
|
||||||
*/
|
*/
|
||||||
int32_t dwSeed;
|
int32_t dwSeed;
|
||||||
uint8_t bId;
|
uint8_t bId;
|
||||||
|
|
|
||||||
|
|
@ -2679,7 +2679,7 @@ bool OperateShrineGloomy(int pnum)
|
||||||
auto &player = Players[pnum];
|
auto &player = Players[pnum];
|
||||||
|
|
||||||
// Increment armor class by 2 and decrements max damage by 1.
|
// Increment armor class by 2 and decrements max damage by 1.
|
||||||
for (ItemStruct &item : PlayerItemsRange(player)) {
|
for (Item &item : PlayerItemsRange(player)) {
|
||||||
switch (item._itype) {
|
switch (item._itype) {
|
||||||
case ITYPE_SWORD:
|
case ITYPE_SWORD:
|
||||||
case ITYPE_AXE:
|
case ITYPE_AXE:
|
||||||
|
|
|
||||||
|
|
@ -35,7 +35,7 @@ void VerifyGoldSeeds(Player &player)
|
||||||
|
|
||||||
} // namespace
|
} // namespace
|
||||||
|
|
||||||
void PackItem(PkItemStruct *id, const ItemStruct *is)
|
void PackItem(PkItemStruct *id, const Item *is)
|
||||||
{
|
{
|
||||||
memset(id, 0, sizeof(*id));
|
memset(id, 0, sizeof(*id));
|
||||||
if (is->isEmpty()) {
|
if (is->isEmpty()) {
|
||||||
|
|
@ -137,14 +137,14 @@ void PackPlayer(PlayerPack *pPack, const Player &player, bool manashield)
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Expand a PkItemStruct in to a ItemStruct
|
* Expand a PkItemStruct in to a Item
|
||||||
*
|
*
|
||||||
* Note: last slot of item[MAXITEMS+1] used as temporary buffer
|
* Note: last slot of item[MAXITEMS+1] used as temporary buffer
|
||||||
* find real name reference below, possibly [sizeof(item[])/sizeof(ItemStruct)]
|
* find real name reference below, possibly [sizeof(item[])/sizeof(Item)]
|
||||||
* @param is The source packed item
|
* @param is The source packed item
|
||||||
* @param id The distination item
|
* @param id The distination item
|
||||||
*/
|
*/
|
||||||
void UnPackItem(const PkItemStruct *is, ItemStruct *id, bool isHellfire)
|
void UnPackItem(const PkItemStruct *is, Item *id, bool isHellfire)
|
||||||
{
|
{
|
||||||
auto &item = Items[MAXITEMS];
|
auto &item = Items[MAXITEMS];
|
||||||
auto idx = static_cast<_item_indexes>(SDL_SwapLE16(is->idx));
|
auto idx = static_cast<_item_indexes>(SDL_SwapLE16(is->idx));
|
||||||
|
|
|
||||||
|
|
@ -81,7 +81,7 @@ struct PlayerPack {
|
||||||
|
|
||||||
void PackPlayer(PlayerPack *pPack, const Player &player, bool manashield);
|
void PackPlayer(PlayerPack *pPack, const Player &player, bool manashield);
|
||||||
void UnPackPlayer(const PlayerPack *pPack, Player &player, bool netSync);
|
void UnPackPlayer(const PlayerPack *pPack, Player &player, bool netSync);
|
||||||
void PackItem(PkItemStruct *id, const ItemStruct *is);
|
void PackItem(PkItemStruct *id, const Item *is);
|
||||||
void UnPackItem(const PkItemStruct *is, ItemStruct *id, bool isHellfire);
|
void UnPackItem(const PkItemStruct *is, Item *id, bool isHellfire);
|
||||||
|
|
||||||
} // namespace devilution
|
} // namespace devilution
|
||||||
|
|
|
||||||
|
|
@ -568,7 +568,7 @@ void StartSpell(int pnum, Direction d, int cx, int cy)
|
||||||
player._pVar4 = GetSpellLevel(pnum, player._pSpell);
|
player._pVar4 = GetSpellLevel(pnum, player._pSpell);
|
||||||
}
|
}
|
||||||
|
|
||||||
void RespawnDeadItem(ItemStruct *itm, Point target)
|
void RespawnDeadItem(Item *itm, Point target)
|
||||||
{
|
{
|
||||||
if (ActiveItemCount >= MAXITEMS)
|
if (ActiveItemCount >= MAXITEMS)
|
||||||
return;
|
return;
|
||||||
|
|
@ -584,7 +584,7 @@ void RespawnDeadItem(ItemStruct *itm, Point target)
|
||||||
itm->_itype = ITYPE_NONE;
|
itm->_itype = ITYPE_NONE;
|
||||||
}
|
}
|
||||||
|
|
||||||
void DeadItem(Player &player, ItemStruct *itm, Displacement direction)
|
void DeadItem(Player &player, Item *itm, Displacement direction)
|
||||||
{
|
{
|
||||||
if (itm->isEmpty())
|
if (itm->isEmpty())
|
||||||
return;
|
return;
|
||||||
|
|
@ -1399,7 +1399,7 @@ bool DoBlock(int pnum)
|
||||||
void DamageArmor(int pnum)
|
void DamageArmor(int pnum)
|
||||||
{
|
{
|
||||||
int a;
|
int a;
|
||||||
ItemStruct *pi;
|
Item *pi;
|
||||||
|
|
||||||
if (pnum != MyPlayerId) {
|
if (pnum != MyPlayerId) {
|
||||||
return;
|
return;
|
||||||
|
|
@ -1540,7 +1540,7 @@ void CheckNewPath(int pnum, bool pmWillBeCalled)
|
||||||
MonsterStruct *monster;
|
MonsterStruct *monster;
|
||||||
Player *target;
|
Player *target;
|
||||||
ObjectStruct *object;
|
ObjectStruct *object;
|
||||||
ItemStruct *item;
|
Item *item;
|
||||||
|
|
||||||
int targetId = player.destParam1;
|
int targetId = player.destParam1;
|
||||||
|
|
||||||
|
|
@ -3049,7 +3049,7 @@ StartPlayerKill(int pnum, int earflag)
|
||||||
DropHalfPlayersGold(pnum);
|
DropHalfPlayersGold(pnum);
|
||||||
if (earflag != -1) {
|
if (earflag != -1) {
|
||||||
if (earflag != 0) {
|
if (earflag != 0) {
|
||||||
ItemStruct ear;
|
Item ear;
|
||||||
SetPlrHandItem(ear, IDI_EAR);
|
SetPlrHandItem(ear, IDI_EAR);
|
||||||
strcpy(ear._iName, fmt::format(_("Ear of {:s}"), player._pName).c_str());
|
strcpy(ear._iName, fmt::format(_("Ear of {:s}"), player._pName).c_str());
|
||||||
switch (player._pClass) {
|
switch (player._pClass) {
|
||||||
|
|
@ -3092,7 +3092,7 @@ StartPlayerKill(int pnum, int earflag)
|
||||||
|
|
||||||
void StripTopGold(Player &player)
|
void StripTopGold(Player &player)
|
||||||
{
|
{
|
||||||
ItemStruct tmpItem = player.HoldItem;
|
Item tmpItem = player.HoldItem;
|
||||||
|
|
||||||
for (int i = 0; i < player._pNumInv; i++) {
|
for (int i = 0; i < player._pNumInv; i++) {
|
||||||
if (player.InvList[i]._itype == ITYPE_GOLD) {
|
if (player.InvList[i]._itype == ITYPE_GOLD) {
|
||||||
|
|
|
||||||
|
|
@ -258,12 +258,12 @@ struct Player {
|
||||||
int _pHFrames;
|
int _pHFrames;
|
||||||
int _pDFrames;
|
int _pDFrames;
|
||||||
int _pBFrames;
|
int _pBFrames;
|
||||||
ItemStruct InvBody[NUM_INVLOC];
|
Item InvBody[NUM_INVLOC];
|
||||||
ItemStruct InvList[NUM_INV_GRID_ELEM];
|
Item InvList[NUM_INV_GRID_ELEM];
|
||||||
int _pNumInv;
|
int _pNumInv;
|
||||||
int8_t InvGrid[NUM_INV_GRID_ELEM];
|
int8_t InvGrid[NUM_INV_GRID_ELEM];
|
||||||
ItemStruct SpdList[MAXBELTITEMS];
|
Item SpdList[MAXBELTITEMS];
|
||||||
ItemStruct HoldItem;
|
Item HoldItem;
|
||||||
int _pIMinDam;
|
int _pIMinDam;
|
||||||
int _pIMaxDam;
|
int _pIMaxDam;
|
||||||
int _pIAC;
|
int _pIAC;
|
||||||
|
|
@ -322,9 +322,9 @@ struct Player {
|
||||||
* matching items were found.
|
* matching items were found.
|
||||||
*/
|
*/
|
||||||
template <typename TPredicate>
|
template <typename TPredicate>
|
||||||
const ItemStruct *GetMostValuableItem(const TPredicate &itemPredicate) const
|
const Item *GetMostValuableItem(const TPredicate &itemPredicate) const
|
||||||
{
|
{
|
||||||
const auto getMostValuableItem = [&itemPredicate](const ItemStruct *begin, const ItemStruct *end, const ItemStruct *mostValuableItem = nullptr) {
|
const auto getMostValuableItem = [&itemPredicate](const Item *begin, const Item *end, const Item *mostValuableItem = nullptr) {
|
||||||
for (const auto *item = begin; item < end; item++) {
|
for (const auto *item = begin; item < end; item++) {
|
||||||
if (item->isEmpty() || !itemPredicate(*item)) {
|
if (item->isEmpty() || !itemPredicate(*item)) {
|
||||||
continue;
|
continue;
|
||||||
|
|
@ -338,7 +338,7 @@ struct Player {
|
||||||
return mostValuableItem;
|
return mostValuableItem;
|
||||||
};
|
};
|
||||||
|
|
||||||
const ItemStruct *mostValuableItem = getMostValuableItem(SpdList, SpdList + MAXBELTITEMS);
|
const Item *mostValuableItem = getMostValuableItem(SpdList, SpdList + MAXBELTITEMS);
|
||||||
mostValuableItem = getMostValuableItem(InvBody, InvBody + inv_body_loc::NUM_INVLOC, mostValuableItem);
|
mostValuableItem = getMostValuableItem(InvBody, InvBody + inv_body_loc::NUM_INVLOC, mostValuableItem);
|
||||||
mostValuableItem = getMostValuableItem(InvList, InvList + _pNumInv, mostValuableItem);
|
mostValuableItem = getMostValuableItem(InvList, InvList + _pNumInv, mostValuableItem);
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -63,7 +63,7 @@ void AddItemToLabelQueue(int id, int x, int y)
|
||||||
{
|
{
|
||||||
if (!IsHighlightingLabelsEnabled())
|
if (!IsHighlightingLabelsEnabled())
|
||||||
return;
|
return;
|
||||||
ItemStruct &item = Items[id];
|
Item &item = Items[id];
|
||||||
|
|
||||||
const char *textOnGround;
|
const char *textOnGround;
|
||||||
if (item._itype == ITYPE_GOLD) {
|
if (item._itype == ITYPE_GOLD) {
|
||||||
|
|
@ -146,7 +146,7 @@ void DrawItemNameLabels(const Surface &out)
|
||||||
}
|
}
|
||||||
|
|
||||||
for (const ItemLabel &label : labelQueue) {
|
for (const ItemLabel &label : labelQueue) {
|
||||||
ItemStruct &item = Items[label.id];
|
Item &item = Items[label.id];
|
||||||
|
|
||||||
if (MousePosition.x >= label.pos.x && MousePosition.x < label.pos.x + label.width && MousePosition.y >= label.pos.y - Height + MarginY && MousePosition.y < label.pos.y + MarginY) {
|
if (MousePosition.x >= label.pos.x && MousePosition.x < label.pos.x + label.width && MousePosition.y >= label.pos.y - Height + MarginY && MousePosition.y < label.pos.y + MarginY) {
|
||||||
if (!gmenu_is_active() && PauseMode == 0 && !MyPlayerIsDead && IsMouseOverGameArea()) {
|
if (!gmenu_is_active() && PauseMode == 0 && !MyPlayerIsDead && IsMouseOverGameArea()) {
|
||||||
|
|
|
||||||
|
|
@ -22,7 +22,7 @@
|
||||||
|
|
||||||
namespace devilution {
|
namespace devilution {
|
||||||
|
|
||||||
ItemStruct golditem;
|
Item golditem;
|
||||||
|
|
||||||
std::optional<CelSprite> pSTextBoxCels;
|
std::optional<CelSprite> pSTextBoxCels;
|
||||||
std::optional<CelSprite> pSTextSlidCels;
|
std::optional<CelSprite> pSTextSlidCels;
|
||||||
|
|
@ -31,19 +31,19 @@ talk_id stextflag;
|
||||||
|
|
||||||
int storenumh;
|
int storenumh;
|
||||||
char storehidx[48];
|
char storehidx[48];
|
||||||
ItemStruct storehold[48];
|
Item storehold[48];
|
||||||
|
|
||||||
ItemStruct smithitem[SMITH_ITEMS];
|
Item smithitem[SMITH_ITEMS];
|
||||||
int numpremium;
|
int numpremium;
|
||||||
int premiumlevel;
|
int premiumlevel;
|
||||||
ItemStruct premiumitems[SMITH_PREMIUM_ITEMS];
|
Item premiumitems[SMITH_PREMIUM_ITEMS];
|
||||||
|
|
||||||
ItemStruct healitem[20];
|
Item healitem[20];
|
||||||
|
|
||||||
ItemStruct witchitem[WITCH_ITEMS];
|
Item witchitem[WITCH_ITEMS];
|
||||||
|
|
||||||
int boylevel;
|
int boylevel;
|
||||||
ItemStruct boyitem;
|
Item boyitem;
|
||||||
|
|
||||||
namespace {
|
namespace {
|
||||||
|
|
||||||
|
|
@ -160,7 +160,7 @@ void AddSText(int x, int y, const char *str, UiFlags flags, bool sel)
|
||||||
stext[y]._ssel = sel;
|
stext[y]._ssel = sel;
|
||||||
}
|
}
|
||||||
|
|
||||||
void PrintStoreItem(ItemStruct *x, int l, UiFlags flags)
|
void PrintStoreItem(Item *x, int l, UiFlags flags)
|
||||||
{
|
{
|
||||||
char sstr[128];
|
char sstr[128];
|
||||||
|
|
||||||
|
|
@ -364,7 +364,7 @@ bool StartSmithPremiumBuy()
|
||||||
|
|
||||||
bool SmithSellOk(int i)
|
bool SmithSellOk(int i)
|
||||||
{
|
{
|
||||||
ItemStruct *pI;
|
Item *pI;
|
||||||
|
|
||||||
if (i >= 0) {
|
if (i >= 0) {
|
||||||
pI = &Players[MyPlayerId].InvList[i];
|
pI = &Players[MyPlayerId].InvList[i];
|
||||||
|
|
@ -668,7 +668,7 @@ void StartWitchBuy()
|
||||||
|
|
||||||
bool WitchSellOk(int i)
|
bool WitchSellOk(int i)
|
||||||
{
|
{
|
||||||
ItemStruct *pI;
|
Item *pI;
|
||||||
|
|
||||||
bool rv = false;
|
bool rv = false;
|
||||||
|
|
||||||
|
|
@ -782,7 +782,7 @@ bool WitchRechargeOk(int i)
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
void AddStoreHoldRecharge(ItemStruct itm, int8_t i)
|
void AddStoreHoldRecharge(Item itm, int8_t i)
|
||||||
{
|
{
|
||||||
storehold[storenumh] = itm;
|
storehold[storenumh] = itm;
|
||||||
storehold[storenumh]._ivalue += spelldata[itm._iSpell].sStaffCost;
|
storehold[storenumh]._ivalue += spelldata[itm._iSpell].sStaffCost;
|
||||||
|
|
@ -1057,7 +1057,7 @@ void StartStoryteller()
|
||||||
AddSLine(5);
|
AddSLine(5);
|
||||||
}
|
}
|
||||||
|
|
||||||
bool IdItemOk(ItemStruct *i)
|
bool IdItemOk(Item *i)
|
||||||
{
|
{
|
||||||
if (i->isEmpty()) {
|
if (i->isEmpty()) {
|
||||||
return false;
|
return false;
|
||||||
|
|
@ -1068,7 +1068,7 @@ bool IdItemOk(ItemStruct *i)
|
||||||
return !i->_iIdentified;
|
return !i->_iIdentified;
|
||||||
}
|
}
|
||||||
|
|
||||||
void AddStoreHoldId(ItemStruct itm, int8_t i)
|
void AddStoreHoldId(Item itm, int8_t i)
|
||||||
{
|
{
|
||||||
storehold[storenumh] = itm;
|
storehold[storenumh] = itm;
|
||||||
storehold[storenumh]._ivalue = 100;
|
storehold[storenumh]._ivalue = 100;
|
||||||
|
|
@ -2174,9 +2174,9 @@ void DrawSelector(const Surface &out, const Rectangle &rect, const char *text, U
|
||||||
|
|
||||||
} // namespace
|
} // namespace
|
||||||
|
|
||||||
void AddStoreHoldRepair(ItemStruct *itm, int8_t i)
|
void AddStoreHoldRepair(Item *itm, int8_t i)
|
||||||
{
|
{
|
||||||
ItemStruct *item;
|
Item *item;
|
||||||
int v;
|
int v;
|
||||||
|
|
||||||
item = &storehold[storenumh];
|
item = &storehold[storenumh];
|
||||||
|
|
|
||||||
|
|
@ -69,32 +69,32 @@ extern int storenumh;
|
||||||
/** Map of inventory items being presented in the store */
|
/** Map of inventory items being presented in the store */
|
||||||
extern char storehidx[48];
|
extern char storehidx[48];
|
||||||
/** Copies of the players items as presented in the store */
|
/** Copies of the players items as presented in the store */
|
||||||
extern ItemStruct storehold[48];
|
extern Item storehold[48];
|
||||||
|
|
||||||
/** Temporary item used to generate gold piles by various function */
|
/** Temporary item used to generate gold piles by various function */
|
||||||
extern ItemStruct golditem;
|
extern Item golditem;
|
||||||
|
|
||||||
/** Items sold by Griswold */
|
/** Items sold by Griswold */
|
||||||
extern ItemStruct smithitem[SMITH_ITEMS];
|
extern Item smithitem[SMITH_ITEMS];
|
||||||
/** Number of premium items for sale by Griswold */
|
/** Number of premium items for sale by Griswold */
|
||||||
extern int numpremium;
|
extern int numpremium;
|
||||||
/** Base level of current premium items sold by Griswold */
|
/** Base level of current premium items sold by Griswold */
|
||||||
extern int premiumlevel;
|
extern int premiumlevel;
|
||||||
/** Premium items sold by Griswold */
|
/** Premium items sold by Griswold */
|
||||||
extern ItemStruct premiumitems[SMITH_PREMIUM_ITEMS];
|
extern Item premiumitems[SMITH_PREMIUM_ITEMS];
|
||||||
|
|
||||||
/** Items sold by Pepin */
|
/** Items sold by Pepin */
|
||||||
extern ItemStruct healitem[20];
|
extern Item healitem[20];
|
||||||
|
|
||||||
/** Items sold by Adria */
|
/** Items sold by Adria */
|
||||||
extern ItemStruct witchitem[WITCH_ITEMS];
|
extern Item witchitem[WITCH_ITEMS];
|
||||||
|
|
||||||
/** Current level of the item sold by Wirt */
|
/** Current level of the item sold by Wirt */
|
||||||
extern int boylevel;
|
extern int boylevel;
|
||||||
/** Current item sold by Wirt */
|
/** Current item sold by Wirt */
|
||||||
extern ItemStruct boyitem;
|
extern Item boyitem;
|
||||||
|
|
||||||
void AddStoreHoldRepair(ItemStruct *itm, int8_t i);
|
void AddStoreHoldRepair(Item *itm, int8_t i);
|
||||||
void InitStores();
|
void InitStores();
|
||||||
void SetupTownStores();
|
void SetupTownStores();
|
||||||
void FreeStoreMem();
|
void FreeStoreMem();
|
||||||
|
|
|
||||||
|
|
@ -7,7 +7,7 @@
|
||||||
using namespace devilution;
|
using namespace devilution;
|
||||||
|
|
||||||
/* Set up a given item as a spell scroll, allowing for its usage. */
|
/* Set up a given item as a spell scroll, allowing for its usage. */
|
||||||
void set_up_scroll(ItemStruct &item, spell_id spell)
|
void set_up_scroll(Item &item, spell_id spell)
|
||||||
{
|
{
|
||||||
pcurs = CURSOR_HAND;
|
pcurs = CURSOR_HAND;
|
||||||
leveltype = DTYPE_CATACOMBS;
|
leveltype = DTYPE_CATACOMBS;
|
||||||
|
|
@ -21,7 +21,7 @@ void set_up_scroll(ItemStruct &item, spell_id spell)
|
||||||
void clear_inventory()
|
void clear_inventory()
|
||||||
{
|
{
|
||||||
for (int i = 0; i < NUM_INV_GRID_ELEM; i++) {
|
for (int i = 0; i < NUM_INV_GRID_ELEM; i++) {
|
||||||
memset(&Players[MyPlayerId].InvList[i], 0, sizeof(ItemStruct));
|
memset(&Players[MyPlayerId].InvList[i], 0, sizeof(Item));
|
||||||
Players[MyPlayerId].InvGrid[i] = 0;
|
Players[MyPlayerId].InvGrid[i] = 0;
|
||||||
}
|
}
|
||||||
Players[MyPlayerId]._pNumInv = 0;
|
Players[MyPlayerId]._pNumInv = 0;
|
||||||
|
|
|
||||||
|
|
@ -86,7 +86,7 @@ typedef struct TestItemStruct {
|
||||||
int IDidx;
|
int IDidx;
|
||||||
} TestItemStruct;
|
} TestItemStruct;
|
||||||
|
|
||||||
static void CompareItems(const ItemStruct *item1, const TestItemStruct *item2)
|
static void CompareItems(const Item *item1, const TestItemStruct *item2)
|
||||||
{
|
{
|
||||||
ASSERT_STREQ(item1->_iIName, item2->_iIName);
|
ASSERT_STREQ(item1->_iIName, item2->_iIName);
|
||||||
EXPECT_EQ(item1->_itype, item2->_itype);
|
EXPECT_EQ(item1->_itype, item2->_itype);
|
||||||
|
|
@ -328,7 +328,7 @@ const TestItemStruct DiabloItems[] = {
|
||||||
|
|
||||||
TEST(pack, UnPackItem_diablo)
|
TEST(pack, UnPackItem_diablo)
|
||||||
{
|
{
|
||||||
ItemStruct id;
|
Item id;
|
||||||
PkItemStruct is;
|
PkItemStruct is;
|
||||||
|
|
||||||
gbIsHellfire = false;
|
gbIsHellfire = false;
|
||||||
|
|
@ -356,7 +356,7 @@ TEST(pack, UnPackItem_diablo_unique_bug)
|
||||||
gbIsMultiplayer = false;
|
gbIsMultiplayer = false;
|
||||||
gbIsSpawn = false;
|
gbIsSpawn = false;
|
||||||
|
|
||||||
ItemStruct id;
|
Item id;
|
||||||
UnPackItem(&pkItemBug, &id, false);
|
UnPackItem(&pkItemBug, &id, false);
|
||||||
ASSERT_STREQ(id._iIName, "Veil of Steel");
|
ASSERT_STREQ(id._iIName, "Veil of Steel");
|
||||||
ASSERT_EQ(id._itype, ITYPE_HELM);
|
ASSERT_EQ(id._itype, ITYPE_HELM);
|
||||||
|
|
@ -399,7 +399,7 @@ const TestItemStruct SpawnItems[] = {
|
||||||
|
|
||||||
TEST(pack, UnPackItem_spawn)
|
TEST(pack, UnPackItem_spawn)
|
||||||
{
|
{
|
||||||
ItemStruct id;
|
Item id;
|
||||||
PkItemStruct is;
|
PkItemStruct is;
|
||||||
|
|
||||||
gbIsHellfire = false;
|
gbIsHellfire = false;
|
||||||
|
|
@ -443,7 +443,7 @@ const TestItemStruct DiabloMPItems[] = {
|
||||||
|
|
||||||
TEST(pack, UnPackItem_diablo_multiplayer)
|
TEST(pack, UnPackItem_diablo_multiplayer)
|
||||||
{
|
{
|
||||||
ItemStruct id;
|
Item id;
|
||||||
PkItemStruct is;
|
PkItemStruct is;
|
||||||
|
|
||||||
gbIsHellfire = false;
|
gbIsHellfire = false;
|
||||||
|
|
@ -652,7 +652,7 @@ const TestItemStruct HellfireItems[] = {
|
||||||
|
|
||||||
TEST(pack, UnPackItem_hellfire)
|
TEST(pack, UnPackItem_hellfire)
|
||||||
{
|
{
|
||||||
ItemStruct id;
|
Item id;
|
||||||
PkItemStruct is;
|
PkItemStruct is;
|
||||||
|
|
||||||
gbIsHellfire = true;
|
gbIsHellfire = true;
|
||||||
|
|
@ -675,7 +675,7 @@ TEST(pack, UnPackItem_hellfire)
|
||||||
TEST(pack, UnPackItem_diablo_strip_hellfire_items)
|
TEST(pack, UnPackItem_diablo_strip_hellfire_items)
|
||||||
{
|
{
|
||||||
PkItemStruct is = { 1478792102, 259, 92, 0, 0, 0, 0, 0, 0, 0 }; // Scroll of Search
|
PkItemStruct is = { 1478792102, 259, 92, 0, 0, 0, 0, 0, 0, 0 }; // Scroll of Search
|
||||||
ItemStruct id;
|
Item id;
|
||||||
|
|
||||||
gbIsHellfire = false;
|
gbIsHellfire = false;
|
||||||
gbIsMultiplayer = false;
|
gbIsMultiplayer = false;
|
||||||
|
|
@ -689,7 +689,7 @@ TEST(pack, UnPackItem_diablo_strip_hellfire_items)
|
||||||
TEST(pack, UnPackItem_empty)
|
TEST(pack, UnPackItem_empty)
|
||||||
{
|
{
|
||||||
PkItemStruct is = { 0, 0, 0xFFFF, 0, 0, 0, 0, 0, 0, 0 };
|
PkItemStruct is = { 0, 0, 0xFFFF, 0, 0, 0, 0, 0, 0, 0 };
|
||||||
ItemStruct id;
|
Item id;
|
||||||
|
|
||||||
UnPackItem(&is, &id, false);
|
UnPackItem(&is, &id, false);
|
||||||
|
|
||||||
|
|
@ -699,7 +699,7 @@ TEST(pack, UnPackItem_empty)
|
||||||
TEST(pack, PackItem_empty)
|
TEST(pack, PackItem_empty)
|
||||||
{
|
{
|
||||||
PkItemStruct is;
|
PkItemStruct is;
|
||||||
ItemStruct id;
|
Item id;
|
||||||
|
|
||||||
id._itype = ITYPE_NONE;
|
id._itype = ITYPE_NONE;
|
||||||
|
|
||||||
|
|
@ -710,7 +710,7 @@ TEST(pack, PackItem_empty)
|
||||||
|
|
||||||
static void compareGold(const PkItemStruct *is, int iCurs)
|
static void compareGold(const PkItemStruct *is, int iCurs)
|
||||||
{
|
{
|
||||||
ItemStruct id;
|
Item id;
|
||||||
UnPackItem(is, &id, false);
|
UnPackItem(is, &id, false);
|
||||||
ASSERT_EQ(id._iCurs, iCurs);
|
ASSERT_EQ(id._iCurs, iCurs);
|
||||||
ASSERT_EQ(id.IDidx, IDI_GOLD);
|
ASSERT_EQ(id.IDidx, IDI_GOLD);
|
||||||
|
|
@ -744,7 +744,7 @@ TEST(pack, UnPackItem_gold_large)
|
||||||
TEST(pack, UnPackItem_ear)
|
TEST(pack, UnPackItem_ear)
|
||||||
{
|
{
|
||||||
PkItemStruct is = { 1633955154, 17509, 23, 111, 103, 117, 101, 68, 19843, 0 };
|
PkItemStruct is = { 1633955154, 17509, 23, 111, 103, 117, 101, 68, 19843, 0 };
|
||||||
ItemStruct id;
|
Item id;
|
||||||
|
|
||||||
UnPackItem(&is, &id, false);
|
UnPackItem(&is, &id, false);
|
||||||
ASSERT_STREQ(id._iName, "Ear of Dead-RogueDM");
|
ASSERT_STREQ(id._iName, "Ear of Dead-RogueDM");
|
||||||
|
|
|
||||||
|
|
@ -10,7 +10,7 @@
|
||||||
|
|
||||||
using namespace devilution;
|
using namespace devilution;
|
||||||
|
|
||||||
static int CountItems(ItemStruct *items, int n)
|
static int CountItems(Item *items, int n)
|
||||||
{
|
{
|
||||||
int count = n;
|
int count = n;
|
||||||
for (int i = 0; i < n; i++)
|
for (int i = 0; i < n; i++)
|
||||||
|
|
|
||||||
|
|
@ -8,7 +8,7 @@ namespace {
|
||||||
|
|
||||||
TEST(Stores, AddStoreHoldRepair_magic)
|
TEST(Stores, AddStoreHoldRepair_magic)
|
||||||
{
|
{
|
||||||
ItemStruct *item;
|
Item *item;
|
||||||
|
|
||||||
item = &storehold[0];
|
item = &storehold[0];
|
||||||
|
|
||||||
|
|
@ -41,7 +41,7 @@ TEST(Stores, AddStoreHoldRepair_magic)
|
||||||
|
|
||||||
TEST(Stores, AddStoreHoldRepair_normal)
|
TEST(Stores, AddStoreHoldRepair_normal)
|
||||||
{
|
{
|
||||||
ItemStruct *item;
|
Item *item;
|
||||||
|
|
||||||
item = &storehold[0];
|
item = &storehold[0];
|
||||||
|
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue