170 Commits
Author SHA1 Message Date
Gleb Mazovetskiy 647f8c38e4 Slightly improve CJK infobox rendering
It still isn't perfect (there just isn't enough space) but we now
cut off fewer pixels at the bottom.
2024-01-11 09:34:35 +00:00
obligaron dc4cd43e8f Remove duplicate function definitions from control.h 2023-12-14 22:17:57 +01:00
Gleb Mazovetskiy 55b0fc5c26 Text inputs: Selection, copy, cut
Adds shift selection, Ctrl+C, and Ctrl+X handling.

Also fixes left-right movement for non-ASCII characters.
2023-10-30 20:34:12 +00:00
Gleb Mazovetskiy 09ab58343c Migrate gold drop/withdrawal to text_input
With this, all text input is handled in a unified way.
2023-10-24 20:11:04 +01:00
Gleb Mazovetskiy fdb5738815 Add cursor support to DiabloUI and chat
Supports move left/right/home/end, backspace, delete, and Ctrl+V.
2023-10-24 01:56:54 +01:00
Gleb Mazovetskiy 848f234aed Add automap type cycling controls
Makes cycling the automap type separate from toggling it on/off.

The TAB key can still be used for quick on/off as usual, while
the new Cycle key ("m" by default) can be used to switch between available
display types.

`Get/NextDebugMonster` debug keybind changed to "v" to avoid a conflict.
2023-09-20 04:50:52 +01:00
Gleb Mazovetskiy 8c1a847f41 Remove utils/stdcompat/string_view.hpp 2023-08-14 09:59:14 +01:00
Gleb Mazovetskiy 14540164a7 Remove utils/stdcompat/optional.hpp 2023-08-14 01:54:29 +01:00
obligaron b916c8e428 Introduce Open/Close/ToggleCharPanel 2023-04-14 02:40:17 +02:00
Gleb Mazovetskiy 1788d2f8ec Remove miniwin
Event handling code moved to `engine/events.{hpp,cpp}`.
2023-02-01 16:06:57 +00: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
Gleb Mazovetskiy 17bcca539f Fix InfoString-related stack-use-after-free 2022-10-30 11:08:06 +00:00
staphen 8b6db3a678 Get rid of panelstr, pnumlines, and ClearPanel() 2022-10-02 08:51:24 +02:00
Gleb Mazovetskiy 961866e1c4 CLX: A new graphics format
The format is almost identical to CL2, except it uses the frame header
to store frame width and height instead of 5 32-line offsets.

This means we always have access to frame dimensions, so we can use it
as an on-disk format for our graphics as well.

Additionally, we may be able to optimize the rendering even more
in the future now that we have guaranteed knowledge of frame dimensions.
2022-08-03 02:38:55 +02:00
Gleb Mazovetskiy a4ac41cece Replace DVL_VK virtual key codes with SDLK 2022-07-17 10:00:06 +01:00
Gleb Mazovetskiy d152d2c0fb Add OptionalOwnedCelSprite 2022-07-03 12:26:39 +01:00
Andrew James 0add7a8af6 Define sizes using Size type in control.cpp/stash.cpp (#4737)
* Use appropriate types for size constants in control.cpp

* Declare constexpr value for iterating over the cells in a stash grid

* Use appropriate type for UIRectangle dimensions
2022-06-18 15:25:52 +02: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
obligaron bc15bdf3a9 Remove PANEL_ defines and replace them with GetMainPanel() 2022-05-29 20:20:44 +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
Gleb Mazovetskiy ade8aba822 Fix some more warnings 2022-04-14 01:26:29 +02:00
Anders Jenbo d0f351db12 Fix splitting gold 2022-03-23 23:08:35 +01:00
Anders Jenbo 6d28810dc7 Change infostr from char[128] to std::string 2022-03-20 14:23:30 +01:00
Andrew James 4ff83431d2 Remove the use of HoldItem in AutoGetItem (#4178) 2022-03-19 14:32:54 +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 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
Gleb Mazovetskiy 076b0c0c05 Overhaul tests
1. Adds a `libdevilution_so` target when tests are enabled.
2. Each test file is now a separate binary target linked against `libdevilutionx_so` (can now run tests in parallel).
3. Tests are now defined in a separate `test/CMakeLists.txt` file.
4. Building the tests is now controlled by the standard `BUILD_TESTING` option (defined by CTest).
5. Tests are now built by default.
6. On CI, test errors are now reported.

Also:

* `.clang-format`: Enable SortIncludes in tests
* `path_test.cpp`: Fix -Wsign-compare
2021-12-16 20:26:51 +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 db7c9d08f5 Move DoSpeedBook to the right header 2021-11-25 02:15:41 +00: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
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
obligaron 677303cba9 Reduce use of view globals in game menu 2021-11-20 21:57:32 +01: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
Stephen C. Wills 423441c3dc Fix speedbook navigation on gamepad 2021-11-03 10:50:35 +01: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 a1f42f199e Fix overflow on long translations
Fixes #3125
2021-10-22 00:34:10 +02:00
Anders Jenbo 7959b04573 SDL1 Unicode input support 2021-09-24 03:03:58 +02:00
obligaron 98eb863ea1 Use SDL Textinput for ingame chat 2021-09-21 21:03:01 +02:00
Anders Jenbo 7771a08d03 Translatable mainpanel 2021-09-19 07:21:52 +02:00
staphen 3df85b70ce Add virtual gamepad event handlers and implement touch controls 2021-09-16 19:25:31 +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 bbf529c65a 🚚 Rename 'PlayerStruct' to 'Player' 2021-08-30 06:44:18 +02:00
obligaron 6be94ceb3f Move DiabloHotkeyMsg to control.cpp and use IsChatAvailable 2021-08-19 03:44:20 +02:00
obligaron 95daecc1bb Introduce GetSpellListSelection and remove selection game logic from DrawSpellList 2021-08-11 02:44:51 +02:00
Anders Jenbo 8df8b940c4 Handle some clang-tidy issues 2021-08-07 16:30:14 +02:00
Aaron Sun 3ee90ca629 Add options for sub-panel alignment 2021-08-07 16:09:32 +02:00