Commit Graph
527 Commits
Author SHA1 Message Date
ephphatha ca1ec8548f Move GoldAutoPlaceInInventorySlot to anonymous namespace 2022-03-06 06:33:11 +01:00
ephphatha f5da32a21c Don't assume holdItem when auto-placing gold 2022-03-06 06:33:11 +01:00
Andrew James f64d17bfa9 Initial clean up of code related to creating items (#2943)
* Move declaration of dItems to items.cpp

This array is never used in dungeon generation, it's closely related to Items so should be kept together. Ideally managing dItems can become responsibility of a container for Items, which will handle adding/removing items from the list and keeping the positions in sync.

* Rename SetPlrHandItem to match purpose/use

* Give more descriptive name to GetPlrHandSeed

This function sets a new seed on a given item struct, not just the held item.

* Don't use HoldItem as a temporary for the players initial inventory

* Take Item by reference in RespawnItem

* Don't use holdItem as a temporary when dropping gold on death

* Update DeadItem to take item by reference, and refer to it consistently

Move code which invalidates the source of dropped items to the caller

Most call sites use a temporary item instance or remove the item from the container, so there's no real point invalidating the item after it's been copied to the drop list.

Update DeadItem to take position instead of player references
2022-03-06 14:53:29 +11:00
Gleb Mazovetskiy 7fede6c4cb Clean up owned/unowned CelSprite ambiguity
Makes `CelSprite` unowned and adds a new `OwnedCelSprite` class for
owned sprites.

This clarifies ownership and makes the code cleaner in a number of
places.

Additionally, because the `CelSprite` class is now tiny (1 less
pointer), we can pass it by-value instead of by-reference, removing a
pointer indirection in the rendering functions.
2022-03-06 04:49:13 +01:00
qndel be0845f41d barb 2h cleanup 2022-03-04 19:45:20 +01:00
staphen 331072cdcf Persist the placed item in AutoPlaceItemInInventorySlot() 2022-02-26 00:14:27 +01:00
ephphatha eeb9ac3303 Sync dropped items if another player triggers an action on the current level 2022-01-24 21:12:13 +01:00
ephphatha db1d776539 Deduplicate PItem and DItem 2022-01-24 21:12:13 +01:00
Anders Jenbo 6b2481a76c Touch support on all SDL2 platforms 2022-01-02 11:37:38 +01:00
ephphatha 77a783098d Use ObjectAtPosition when checking if an item can be dropped
This extracts some of the common object logic from ItemSpaceOk and CanPut, these functions are almost identical except for the way players and monsters are checked...
2021-12-28 16:01:37 +01:00
ephphatha e633d7ff1e Restrict dropping items to adjacent tiles
This more closely matches vanilla behaviour until more intelligent dropping item behaviour is implemented (see #3489)
2021-12-28 15:56:55 +01:00
Anders Jenbo 6d346c7e18 Use std::string in PrintItemPower 2021-12-13 01:02:07 +01:00
ephphatha bda0a0624b Replace some usages of Item.statFlag 2021-12-12 20:07:05 +01:00
Andrew James a1a64ef32e fix negated check in SyncGetItem
I missed this when resolving merge conflicts :/
2021-12-07 00:44:34 +01:00
obligaron ff5de056fa Add all (boolean) Game Settings to Settingsmenu (#3616) 2021-11-26 23:43:46 +01:00
Gleb Mazovetskiy c57644970f Move UiFlags and UiPanels into their own files
The first breaks circular dependency between `DiabloUI` and `text_render`.
The latter one moves `UiPanels` to a more appropriate place.
2021-11-25 12:22:27 +01:00
Andrew James 4a940b1b07 Remove uses of Items[] as a temporary for other Item variables (#2924) 2021-11-25 09:34:13 +01:00
Gleb MazovetskiyandAnders Jenbo 7e1fea6f76 clang-format all files in {Source,test}/
Also includes a few manual tweaks to comments and newlines for better results.

Co-authored-by: Anders Jenbo <[email protected]>
2021-11-24 23:44:12 +01:00
obligaron cb6d49e697 Add OptionEntry Item Pickup Sound 2021-11-24 09:31:39 +01:00
obligaron 82b86d9042 Add OptionEntry Auto Equip Sound 2021-11-24 09:31:39 +01:00
ephphatha 18658f6a42 Remove duplicate argument to DeleteItem 2021-11-23 19:08:41 +01:00
ephphatha baa1cd65c5 Make FindGetItem return an index into ActiveItems
This allows the calling code in DeltaLoadLevel to behave the same as every other use of DeleteItem, making it possible to remove the duplicate argument and ensure that the ActiveItems/AvailableItems arrays are treated appropriately.
2021-11-23 19:08:41 +01:00
ephphatha 1d560601f2 Remove duplicated argument to InvGetItem
This was obscuring efforts to track how ActiveItems and Items are referenced, hopefully can switch back to the Item& soon.
2021-11-23 19:08:41 +01:00
obligaron 677303cba9 Reduce use of view globals in game menu 2021-11-20 21:57:32 +01:00
Gleb Mazovetskiy b8affd5fe5 Fix a few build warnings 2021-11-08 23:33:08 +01:00
Anders Jenbo 56170b3372 Clean up id normalization 2021-11-07 23:15:10 +01:00
ephphatha 335b0b9349 Use crawl table based search for item checks
fixes #3207
2021-11-07 20:13:31 +01:00
joewis 9cd6f206ad Disable shift-clicking of items you don't have stats to wear 2021-11-01 00:54:59 +01:00
Gleb Mazovetskiy 64a88343e8 Refactor: Use item iterators in 7 more places 2021-10-31 13:28:08 +00:00
obligaron 2158faadab Use SDL_StartTextInput for gold drop dialog 2021-10-27 00:06:30 +02:00
obligaron 98ecd0ecc5 Introduce CloseGoldDrop 2021-10-27 00:06:30 +02:00
Joerg Wissen a274c6eab4 Swap weapons between body and inventory with shift-click 2021-10-26 11:09:37 +02:00
obligaron f142b63664 Disallow to swap gear while not standing/walking. 2021-10-24 23:07:15 +02:00
Joerg Wissen 4e7d6b8f9e Optional feature to auto-refill belt from inventory (#983) 2021-10-21 22:57:08 +00:00
Bernd Stellwag fcc0266703 Add new option to enable/disable item pickup sounds 2021-10-21 22:29:10 +00:00
staphen ab13fba13f Use Rune Bomb or Cathedral Map to open Hive or Crypt 2021-10-12 15:21:37 +02:00
staphen ee23f41e0c Enable opening Hive and Crypt using gamepad 2021-10-12 04:40:43 +02:00
Bernd Stellwag f1a0aa3b49 Replace broken link with @see annotation to text representation of the linked image 2021-10-09 22:30:31 +02:00
Yuri Pourre 7d74336e6b Enhance ctrl + drop 2021-10-09 16:16:51 +02:00
ephphatha 4198a19787 Remove debug assert after picking up an item
Doesn't really do anything useful. If the target position doesn't contain an item on the local client the code looks for a matching dropped item and tries to pick that up instead. It doesn't really make sense to assert that an item exists at the target position or that it matches, a desync has already happened by this point if the checks on lines 1647 or 1649 are false.
2021-10-07 12:01:25 +02:00
Anders Jenbo 31ba8e2bc6 Validate additional network messages 2021-10-06 21:47:03 +02:00
Yuri Pourre b8450dc792 Assign ctrl to drop items 2021-09-29 18:15:26 +02:00
obligaron 24c5ee8bd2 Draw belt item number for unusable scrolls 2021-09-26 10:50:00 +02:00
Gleb Mazovetskiy ec13c333a9 Refactor: Use item iterators for scroll checks
Refs #2586
2021-09-24 01:56:44 +01:00
qndel 70dc796287 proper fix 2021-09-22 13:06:03 +02:00
qndel 81199b14af fix wrong armor display in multiplayer 2021-09-22 09:10:58 +02:00
Anders Jenbo 7771a08d03 Translatable mainpanel 2021-09-19 07:21:52 +02:00
Juliano Leal Goncalves 379a27b64a ♻️ Convert 'ItemType' enum to enum class
🎨 Rename 'ItemType' elements to enum class standards
2021-09-13 00:25:49 +02:00
Juliano Leal Goncalves e39b33971f ♻️ Leverage 'IsAnyOf' 2021-09-13 00:25:49 +02:00
Juliano Leal Goncalves 094f308d22 🐛 Use 'Spell' instead of 'RSpell' for clearing used staff charges
Readied spell can be swapped to something else in between the cast and the hit frame, resulting in incorrect removal.

This is how currently belt and inventory scrolls are checked so we are now using a consistent strategy.
2021-09-12 05:02:06 +02:00