Commit Graph
557 Commits
Author SHA1 Message Date
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
ephphatha 026b428c7d Add NewCursor(Item&) for setting the cursor based on a held item
The case for empty items should never be hit in the current code, but I've got a related PR that'll make use of that so adding it now.
2022-04-18 16:59:34 +02:00
Anders Jenbo dc706e8ed5 Use HoldItem for determining if an item is held
This cleans up a bit of code and solves a few edge cases where an item
could be lost, the game be unresponsive, or miss fire an event during
lag cause of the cursor not reflecting the currently held item.
2022-04-18 11:27:07 +02:00
DakkJaniels ac2e2800b5 Fix Durability Icons (#4475)
* fix 0 index for durability icons

* Add ItemType::Shield (clarity)

Add ItemType::Shield to switch/case for clarity, so it is clear that this is what the default option was to show.
2022-04-17 16:35:10 +02:00
Stephen C. Wills 24813302c8 Fix frame index of Level Up icon (#4442) 2022-04-15 05:30:31 +02: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 e29bf228fd Correctly center panel text when holding red item 2022-04-03 03:57:18 +02:00
Anders Jenbo 6c97fae5b0 Update translation template 2022-03-30 14:05:18 +02:00
Anders Jenbo e2fef44c9f Close gold withdraw when closing stash 2022-03-27 18:08:02 +02:00
Anders Jenbo d0f351db12 Fix splitting gold 2022-03-23 23:08:35 +01:00
Anders Jenbo 1ba817ca53 Unify gold handling (withdraw any amount from stash) 2022-03-22 21:38:51 +01:00
Anders Jenbo 6d28810dc7 Change infostr from char[128] to std::string 2022-03-20 14:23:30 +01:00
Anders Jenbo 1409e604f5 Reduce string conversions 2022-03-20 11:04:15 +01:00
Andrew James 4ff83431d2 Remove the use of HoldItem in AutoGetItem (#4178) 2022-03-19 14:32:54 +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
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
Felipe Wannmacher 6a6fd404dc improved hints and added icons 2022-03-04 19:40:35 +01:00
qndel 9ba64ad08b TRN rewrite + bugfix (#4056)
* working new TRN system
* apply TRNs to all unique missiles
2022-02-20 14:28:51 +01:00
qndel 9536927301 Display hp/mana values on life/mana orbs (#4006) 2022-01-27 12:19:32 +01:00
Anders Jenbo 6b2481a76c Touch support on all SDL2 platforms 2022-01-02 11:37:38 +01:00
obligaron 419fe7b7ec Change Keymapper to OptionCategory/OptionEntry 2021-12-23 00:26:12 +01:00
obligaron 7b2f651bb2 Allow QuickMessages to contain multiple entries/lines 2021-12-14 08:15:20 +01:00
ephphatha bda0a0624b Replace some usages of Item.statFlag 2021-12-12 20:07:05 +01:00
Gleb Mazovetskiy a4bc8fea7d Fix warnings: -Wsign-compare, -Wnarrowing 2021-12-08 23:03:20 +00: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
Gleb Mazovetskiy 8d1708358f Extract spell list and book into separate files
Moves the spell list/book UI from `control.cpp` code into separate files.
2021-11-23 21:38:06 +00:00
Gleb Mazovetskiy 1eb6e2bac0 Improved spell book layout 2021-11-23 16:42:01 +01:00
Anders Jenbo 799f1763af Performce UTF8 aware limited string copies 2021-11-22 03:28:51 +01:00
obligaron 677303cba9 Reduce use of view globals in game menu 2021-11-20 21:57:32 +01:00
Anders Jenbo 9a93e473f9 Align CJK text on spell icons 2021-11-20 02:31:21 +00:00
Gleb Mazovetskiy 3aa8149d3e PrintMonstHistory: Fix string manipulation
The code previously assumed that there is an ASCII separator after each
resistance type.

Different languages may use something else entirely. Relaxes the
assumption to any single code point to avoid producing malformed
UTF-8.
2021-11-14 07:35:10 +00:00
Gleb Mazovetskiy e9a9daa794 DrawString: Stop allocating
Switch to a state-machine UTF-8 decoder from the branchless one.
This allows us to avoid copying the string on every `DrawString` call.
2021-11-07 04:17:50 +01:00
staphen b5d96665c9 Enable SDL1 build option for Windows 2021-11-05 10:34:51 +01:00
Stephen C. Wills 423441c3dc Fix speedbook navigation on gamepad 2021-11-03 10:50:35 +01:00
ephphatha d2940e8f7f Update GetObjectStr to take a const Object&
Brings it in line with GetItemStr
2021-11-01 12:44:46 +01:00
ephphatha 5f112576a4 move variable declaration into correct scope 2021-11-01 12:44:46 +01:00
Anders Jenbo af433d8890 Check for null spells 2021-10-28 02:29:35 +02:00
qndel 124675386d refresh panel when chat is active 2021-10-27 13:47:35 +02: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
Anders Jenbo 97e6c712c8 Correctly position durability icons
Fixes #3275
2021-10-26 02:48:53 +02:00
Anders Jenbo a1f42f199e Fix overflow on long translations
Fixes #3125
2021-10-22 00:34:10 +02:00
Anders Jenbo cab3494c93 Position panels away from touch controls 2021-10-16 23:44:43 +02:00
ephphatha 0aafd6d73d Render panel string containing scroll count when browsing spell list 2021-10-10 14:55:17 +02:00
Gleb Mazovetskiy 0c694edaba WordWrapString: Wrap on punctuation
Useful for Chinese and Japanese, which do not have spaces between words,
nor whitespace after punctuation.
2021-09-30 18:16:31 +02:00
Yuri Pourre 91d813ddd0 Makes spell highlight translatable 2021-09-30 02:41:46 +02:00
Anders Jenbo f54b7d0896 🚨 Count of letters is always positive 2021-09-28 08:49:28 +02:00