48 Commits
Author SHA1 Message Date
obligaron 8bda637a08 Introduce IsValidSpeedSpell 2023-12-14 22:17:57 +01:00
obligaron 658918e5e6 Support unsetting spell hotkey 2023-12-14 22:17:57 +01:00
Gleb Mazovetskiy e5881688f4 text_render: Replace optional args with struct
4 options args are a bit unwieldy, especially when you want
to pass only the first and the last one.

With a struct, there is no need to specify the default values
for the args in between.
2023-10-25 09:19:14 +01:00
Gleb Mazovetskiy d262589021 Support const inventory iterators
Previously, inventory iterators could only be used with non-const
objects, leading to suboptimal const correctness.

Adds support for `const` objects to inventory iterators via
C++17 CTAD.
2023-08-16 06:01:03 +09:00
Gleb Mazovetskiy d5446f2f01 Use std::variant in StringOrView
We also add a direct string move-assignment (`operator=(std::string &&)`),
which results in better codegen.

As a consequence, we have to replace `= {}` assignments with `= StringOrView {}`
because `= {}` is now ambiguous.
2023-08-14 10:55:02 +01:00
Gleb Mazovetskiy 8c1a847f41 Remove utils/stdcompat/string_view.hpp 2023-08-14 09:59:14 +01:00
Gleb Mazovetskiy 8101e2c0ba Add c_any_of and friends
Adds handy helpers for performing algorithms on the entire container.
They're prefixed with `c_` for container.

This naming convention is identical to some popular C++ libraries, such
as Abseil.
2023-08-12 16:24:01 +01:00
Gleb Mazovetskiy 5bf0b8bc96 Add more missing <cstdint> includes
https://github.com/diasurgical/devilutionX/pull/6095 only added includes
for `uint32_t`, this PR also adds the includes for the remaining
integral types.
2023-05-10 16:29:27 +01:00
staphen 6bcb4d70e4 Use padmapper bindings on spell icons 2023-04-15 09:53:49 +02:00
Gleb Mazovetskiy ebcd6b222d Optimize SpellData size: 40 bytes -> 24 2023-02-10 10:51:06 +00:00
Gleb Mazovetskiy b61dac853b Add GetSpellData(SpellID) 2023-02-05 12:12:48 +00:00
KPhoenix d813f13700 enum spell_id -> enum class SpellID 2023-02-05 10:24:58 +00:00
Gleb Mazovetskiy 1788d2f8ec Remove miniwin
Event handling code moved to `engine/events.{hpp,cpp}`.
2023-02-01 16:06:57 +00:00
DakkJaniels 0c1c8d0aa0 fix speedbook crash (#5730) 2023-01-29 02:27:48 +00:00
Eric Robinson 049f75515b Fix bug in ef3a57b7 (#5732) 2023-01-29 02:59:30 +01:00
Eric Robinson ef3a57b7d9 enum spell_type -> enum class SpellType (#5674) 2023-01-28 22:25:37 +01:00
Anders Jenbo e50e21e0e4 Use outline for spell icon texts 2023-01-12 11:04:53 +01:00
Gleb Mazovetskiy 46e755f680 Simplify spell icon handling
Hide the internals of spell icon rendering behind simple functions.
2022-11-22 02:37:19 +01:00
Gleb Mazovetskiy 680ab5ec40 Overhaul backbuffer state handling
When rendering directly to the output buffer, we need to maintain the
state of what has been drawn and what needs redrawing per-buffer.

We previously tried to do it implicitly by checking `SDL_DOUBLEBUF` and
other flags. The previous implementation was broken in several
ways, resulting in rendering issues on devices that support 8-bit output
directly.

Changes this mechanism to explicitly maintain buffer state per output
buffer. The new mechanism doesn't require knowledge of the number of
buffers, and thus also works correctly with triple-buffering.

Fixes #5447
2022-11-01 02:43:24 +00:00
staphen 8b6db3a678 Get rid of panelstr, pnumlines, and ClearPanel() 2022-10-02 08:51:24 +02:00
KPhoenix a1822bca8e Remove sSkillText from spelldat.cpp 2022-09-21 23:48:08 +02:00
Anders Jenbo 3ae834148a Split event handeling from general miniwin features 2022-07-10 21:13:39 +02:00
Anders Jenbo 2d21fc372e Remove more miniwin code 2022-07-10 21:13:39 +02:00
Anders Jenbo 6a8fd04067 Use player by references (#4938) 2022-07-10 11:40:04 +02:00
Gleb Mazovetskiy 197e1180b2 Add StrCat and StrAppend
Adds simple string / integer concatenation functions.

Many of the uses of `fmt::format` are simply concatenation
of a few strings and integers.

`StrCat` is an easier-to-read alternative to such uses of `fmt`.
2022-07-10 06:14:58 +02:00
staphen cab75ded6b Check both SPL_NULL and SPL_INVALID to determine spell validity 2022-07-09 04:04:22 +02:00
Gleb Mazovetskiy 17f8cdddc4 Clean up GetSpellLevel
Remove the buggy `GetSpellLevel` implementation and use
`Player#GetSpellLevel` throughout instead.
2022-07-03 13:40:53 +01:00
Anders Jenbo 72656b3011 Move path and palette to the engine folder 2022-06-24 16:34:20 +02:00
obligaron 9ac04314f4 Introduce Player::isOnLevel 2022-06-18 17:05:30 +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
qndel 354e329644 Players[MyPlayerId] -> MyPlayer 2022-05-31 05:35:52 +02:00
obligaron bc15bdf3a9 Remove PANEL_ defines and replace them with GetMainPanel() 2022-05-29 20:20:44 +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
Gleb Mazovetskiy a66ca44695 Zero-based frame indexing
Index frames starting at 0 instead of 1.
2022-04-14 04:39:26 +01:00
Gleb Mazovetskiy ade8aba822 Fix some more warnings 2022-04-14 01:26:29 +02:00
Gleb Mazovetskiy e3945da045 Fix a negative shift exponent sanitizer warning
Source/spells.h:54:14: runtime error: shift exponent -1 is negative
2022-04-09 03:08:52 +02:00
Drakker 3039b760e1 Added more Quickspell hotkeys for a total of 16. Saving will write the number of configured quickspell slots at the beginning of the hotkeys file. The loader will check the size, if its bigger than older saves should be it will load the header and read the hotkeys, otherwise it will load 4 quickspells for compatibility. 2022-04-02 20:19:46 +02: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
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
obligaron 419fe7b7ec Change Keymapper to OptionCategory/OptionEntry 2021-12-23 00:26:12 +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
Vladimir Olteanu 210ea7d18d Always draw spell hotkey in town 2021-11-24 09:37:00 +01:00
Vladimir OlteanuandGleb Mazovetskiy 14eae23441 Spell list: always draw hotkeys
Co-authored-by: Gleb Mazovetskiy <[email protected]>
2021-11-24 00:21:26 +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