Commit Graph
836 Commits
Author SHA1 Message Date
Anders Jenbo d17d7e018d Use common function for loading .dun tile data 2022-06-15 14:18:06 +02:00
Gleb Mazovetskiy 1fc8ecb6f6 Add fmt::runtime annotations for C++20 support
`fmt` requires non-contexpr format string arguments to be wrapped in
`fmt::runtime` in C++20.
2022-06-14 12:46:36 +01:00
Gleb Mazovetskiy 779ccaca17 Overhaul translation fetching
1. Do not modify the map after loading. Instead, return string views
   (guaranteed to be null-terminated) from look up functions and return
   the key directly if not found.
2. Use an `unorded_map` instead of `map` where available (C++20).
   Saves a bit of RAM (~50 KiB) and improves lookup performance.
2022-06-14 12:46:36 +01:00
Anders Jenbo 1203514383 Clean up use of currlevel 2022-06-07 21:35:01 +02:00
staphen a2fe3a981e Fix issues with ears due to translation 2022-06-06 07:26:43 +02:00
qndel 354e329644 Players[MyPlayerId] -> MyPlayer 2022-05-31 05:35:52 +02:00
obligaron 70c5cf6cad Fix item label text with open stash (#4595)
* Item labels: check if stash is open in IsMouseOverGameArea

* Add IsLeft/RightPanelOpen
2022-05-20 09:12:54 +02:00
ephphatha 4d7c08d5b4 Deduplicate code for setting stat requirements/flag 2022-04-21 05:44:38 +02:00
ephphatha ca48efc185 Update spell book requirements when refreshing stash items 2022-04-21 05:44:38 +02:00
ephphatha 64a2c41b2c Set clang-tidy config for MethodCase option
Previously this was falling back to FunctionCase, leading to inconsistent casing of class methods throughout the codebase. Applied to Item as an example.
2022-04-20 13:50:57 +02:00
DakkJaniels dad46e1905 Item special effect enum (#4129) 2022-04-19 15:44:46 +02:00
ephphatha 7e7798fd2b Add function to mark an item as empty 2022-04-18 19:25:55 +02:00
Anders Jenbo dfd8bdab70 Avoid using HeldItem in CreatePlrItems (#4308) 2022-04-18 13:46:15 +10:00
Gleb Mazovetskiy a66ca44695 Zero-based frame indexing
Index frames starting at 0 instead of 1.
2022-04-14 04:39:26 +01:00
Anders Jenbo b9b7e9698a Revert IPL_TARGAC description
Lets give it a better one later
2022-04-13 04:52:49 +02:00
qndel e3019b43b0 fix armor pierce on uniques and display affix values 2022-04-10 21:00:00 +02:00
Stephen C. Wills 28e9210812 Update magic requirement for stashed books (#4376) 2022-04-10 05:25:52 +02:00
staphen e6182709d1 Allow casting Town Portal, Teleport, and Guardian scrolls from inventory 2022-04-03 23:37:00 +02:00
Anders Jenbo 7e83aa1429 Improve item hints for gamepads 2022-03-30 19:02:45 +02:00
Gleb Mazovetskiy 2f22d94e0d Remove OwnedCelSprite::Unowned method
Conversion is already provided by the `CelSprite(const OwnedCelSprite &)` constructor.
2022-03-23 10:09:18 +01:00
Anders Jenbo 1ba817ca53 Unify gold handling (withdraw any amount from stash) 2022-03-22 21:38:51 +01:00
obligaron 3e9ca60460 Update _iStatFlag for stash items 2022-03-20 23:42:55 +01:00
Anders Jenbo 6d28810dc7 Change infostr from char[128] to std::string 2022-03-20 14:23:30 +01:00
Anders Jenbo 55a0b71b1c Only spawn loot once 2022-03-20 11:12:08 +01:00
Anders Jenbo 1409e604f5 Reduce string conversions 2022-03-20 11:04:15 +01:00
obligaron ef7966393b Enable apply oil on stash items 2022-03-19 11:20:23 +01:00
obligaron 9183b6fa57 Enable recharge on stash items 2022-03-19 11:20:23 +01:00
obligaron 1f866bd53b Enable repair on stash items 2022-03-19 11:20:23 +01:00
obligaron ae5423ad68 Enable identify on stash items 2022-03-19 11:20:23 +01:00
Anders Jenbo be57d62684 Use UTF8 aware string copying 2022-03-19 06:03:19 +01:00
Anders Jenbo 718c46e7fe Remove use of tempstr 2022-03-19 06:03:19 +01:00
Anders Jenbo a48f89007d Implement stash 2022-03-18 06:01:53 +01:00
qndel 220e9f092b ignore auric amulet of other players in MP (#4151) 2022-03-11 03:58:25 +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
DakkJaniels 0bae1ea3a1 switch affix_item_type bit flag enum to class format (#4123) 2022-03-06 04:19:33 +01:00
DakkJaniels 7bc19ee91a add enum for the spell flags. Adjust code to use them. 2022-03-06 02:09:19 +01:00
qndel be0845f41d barb 2h cleanup 2022-03-04 19:45:20 +01:00
DakkJaniels 6e9fd1b18b Max Resist Item Formatting (#4104)
Change to use MAXRESIST instead of hardcoded 75 when printing resists to panel, in case someone were to change the MAXRESIST number.
2022-03-03 13:02:10 +01:00
Gleb Mazovetskiy 1519e995cf Move store graphics out of stores.cpp
These graphics are used in various places outside of `stores.cpp`.
2022-01-30 14:56:04 +01:00
ephphatha 68b3252d24 Call dropitem when spawning a quest reward in a network game
This allows the item to appear in the delta sync when a new player joins the game, but does not cause the item to drop for other players on the same level at the time the action occurs due to differences in the way this message is handled.
2022-01-24 21:12:13 +01:00
ephphatha db1d776539 Deduplicate PItem and DItem 2022-01-24 21:12:13 +01:00
staphen b85485b8f3 Resolve game crash when syncing Diablo items in Hellfire games 2022-01-17 00:31:27 +01:00
obligaron 35dc64312e Show preview CelSprite for player actions (Introduce PlayerStruct.pPreviewCelSprite and UpdatePreviewFrame) 2022-01-12 12:26:39 +01:00
ephphatha 8bf05571a1 Dedupe code which determines how much life/mana to restore for potions
This is very similar to the code used when casting heal other, except for how the amount to heal is chosen. Could potentially reuse it there as well with a bit of work.
2022-01-08 09:29:26 +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
Anders Jenbo 6de6825ce0 Correct false positives translation warnings 2021-12-25 11:10:57 +01:00
Anders Jenbo 6d346c7e18 Use std::string in PrintItemPower 2021-12-13 01:02:07 +01:00
Anders Jenbo af08a99691 Perform item requirement check when entering vendors 2021-12-13 00:56:38 +01:00
ephphatha 3598ee313c Remove StoreStatOk, replace with calls to CanUseItem 2021-12-12 20:07:05 +01:00