Commit Graph
540 Commits
Author SHA1 Message Date
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
Anders Jenbo 7a57ae211e Better text alignment in spell book 2021-09-26 04:17:39 +02:00
Anders Jenbo 70cff81547 Implement backspace for UTF-8 strings 2021-09-24 03:03:58 +02:00
Anders Jenbo 7959b04573 SDL1 Unicode input support 2021-09-24 03:03:58 +02:00
Anders Jenbo 704a04ae4d Add support for Unicode fonts 2021-09-24 03:03:58 +02:00
Gleb Mazovetskiy ec13c333a9 Refactor: Use item iterators for scroll checks
Refs #2586
2021-09-24 01:56:44 +01:00
obligaron 98eb863ea1 Use SDL Textinput for ingame chat 2021-09-21 21:03:01 +02:00
Anders Jenbo 671fdbd125 Implement contextural translation (pgettext)
Fixes #2369
Fixes #2790
2021-09-20 04:18:35 +02:00
Anders Jenbo 7771a08d03 Translatable mainpanel 2021-09-19 07:21:52 +02:00
staphen fe3d50f7f2 Merge logic from InitControlPan() and ClearPanBtn() 2021-09-17 00:51:08 +02:00
staphen 3df85b70ce Add virtual gamepad event handlers and implement touch controls 2021-09-16 19:25:31 +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
Anders Jenbo 064a70a9b1 Fix double encoding of monster names 2021-09-12 01:37:28 +02:00
Anders Jenbo 7169882b1f ✨ Implement new font rendering 2021-09-12 01:37:28 +02:00
qndel a737d72dd9 Dynamic char panel 2021-08-30 20:33:55 +02:00
BC Ko 1cebabcfff documentation cleanup: control 2021-08-30 13:51:42 +02:00
Juliano Leal Goncalves bb2dfdfb73 🚚 Rename 'ItemStruct' to 'Item' 2021-08-30 13:40:08 +02:00
Juliano Leal Goncalves 6c21638bee ♻️ Leverage 'Point' in 'SetCursorPos' function 2021-08-30 06:45:51 +02:00