Commit Graph
160 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 7a3722d63b Add helper for clearing an item and using it's old value
Used when moving from one persistent variable to another where we want the source variable to be marked empty. Defining as a function instead of move constructor/assignment operator as we only really need to mark the source for xvalues. Detecting that in the constructor/assignment would be needlessly complicated.
2022-04-20 13:35:55 +02:00
ephphatha 8d3f39d2e5 Clear the held item if it is used to open a quest entrance 2022-04-18 19:25:55 +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
ephphatha 0595593f6f Move the adjustment for large items out of InvGetEquipSlotCoord 2022-04-16 05:54:03 +02:00
ephphatha c0a7f35bb9 Only attempt to lookup mouse position if the slot changes 2022-04-16 05:54:03 +02:00
ephphatha b2127d07dc Change InventoryMoveToBody side-effect to return value
This makes the call sites use the same pattern as every other inventory movement. See the next commit for why :D
2022-04-16 05:54:03 +02:00
ephphatha 40a0d6dda3 Replace uses of icursSize28 with local itemSize variable
Re-ordered the last couple of if conditions to make it clearer what the impact of the adjustments to mouse position are.
2022-04-16 05:54:03 +02:00
ephphatha 0adf0fb1f3 Use GetInventorySize in GetItemSizeOnSlot 2022-04-16 05:54:03 +02:00
ephphathaandqndel 907e1376b0 Add function to get item id at grid coords
Also introduced a few helper types and values to hopefully help document behaviour

correct spelling in comment

Co-authored-by: qndel <[email protected]>
2022-04-16 00:35:28 +02:00
ephphatha 5f788a6e04 Be explicit about the cursor overlap checks when acting on inventory cells 2022-04-15 09:41:37 +02:00
Gleb Mazovetskiy ade8aba822 Fix some more warnings 2022-04-14 01:26:29 +02:00
Anders Jenbo 66d7a3c222 [gamepad] Reuse repeat logic from mouse 2022-04-13 02:13:31 +02:00
Gleb Mazovetskiy 235451ae5a Reduce debug log output of Control 2022-04-11 23:35:03 +02:00
staphen 2759eb130b Update player's spell target when using quick cast on gamepad 2022-04-10 17:32:16 +02:00
Gleb Mazovetskiy 4c2fa76e49 Controller mouse emulation fixes
1. Do not interrupt mouse mode on virtual clicks.
2. Handle virtual clicks directly instead of sending an SDL event.
3. Fix D-Pad mouse emulation state handling.
4. Hides the modifier hints during D-Pad mouse emulation.
2022-04-09 04:17:39 +02:00
Felipe Wannmacher 889cc04f95 Enhanced attack using controllers (#4019) 2022-04-04 14:19:16 +02:00
Gleb Mazovetskiy 79c7eee10a Mouse/Gamepad fixes
Introduces a `ControlDevice` global which is distinct from `ControlMode`
in that it is set to `Gamepad` even when simulating a mouse.

This allows us to avoid a number of edge cases related to mode changes.

Fixes #4242
2022-04-03 23:06:36 +01:00
staphen e6182709d1 Allow casting Town Portal, Teleport, and Guardian scrolls from inventory 2022-04-03 23:37:00 +02:00
staphen 6a30cd3950 Add gamepad support for stash 2022-03-30 23:12:09 +02:00
Anders Jenbo 8235380ef9 [gamepad] Avoid OOB on empty belt 2022-03-27 18:22:45 +02:00
Anders Jenbo 9d65580294 [gamepad] Fix managing belt 2022-03-27 10:01:29 +02:00
obligaron 481f15ded5 Introduce StashStruct.GetPage/SetPage 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 fbabb96464 [gamepad] Align cursor after using item 2022-03-18 09:10:32 +01:00
Anders Jenbo a48f89007d Implement stash 2022-03-18 06:01:53 +01:00
qndel 48f102eff1 Chat log 2022-03-06 01:02:55 +01:00
ephphatha db1d776539 Deduplicate PItem and DItem 2022-01-24 21:12:13 +01:00
obligaron 234a053863 Change Missiles Array to std::list 2022-01-20 23:12:48 +01:00
ephphatha 3bc2eb8471 Use ObjectAtPosition when highlighting from gamepad movement 2022-01-19 03:05:27 +01:00
ephphatha 5c4f6d80e8 Use Point/range iterator in FindItemOrObject
This addresses a todo comment, though not in the way that was originally intended as we no longer use Direction::Omni
2022-01-19 03:05:27 +01:00
Anders Jenbo b0252b3339 Make Gamepad cursor independant of hardware mouse
The gamepad cursor (inventory, spells etc) no longer relies on warping a
real mouse cursor. This should make things work better on platforms that
do not support this, like Wayland.
2022-01-02 11:37:38 +01:00
Anders Jenbo 576d946581 Allow use of touch to select world objects 2022-01-02 11:37:38 +01:00
Anders Jenbo 6b2481a76c Touch support on all SDL2 platforms 2022-01-02 11:37:38 +01:00
qndel be0b79f9f5 Add IsWallSpell helper 2021-12-07 12:00:52 +01:00
Anders Jenbo 28ad032a2f 🐛 [gamepad] Fix casting lightningwalls
Fixes #3694
2021-12-07 01:37:58 +01:00
Vladimir Olteanu 861fb99e9d Quick cast 2021-12-04 15:38:58 +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
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
Anders Jenbo 56170b3372 Clean up id normalization 2021-11-07 23:15:10 +01:00
Andrew James 796e2813cf Use scoped enums for DungeonFlags/BFLAG (#3135) 2021-11-07 03:11:16 +01:00
Gleb Mazovetskiy 12b73076b8 Fix build error in plrctrl.cpp (#3374)
Follow-up to #3370
2021-11-03 10:59:10 +01:00
Stephen C. Wills 423441c3dc Fix speedbook navigation on gamepad 2021-11-03 10:50:35 +01:00
staphen 884f9ed46b [Virtual Gamepad] Turn player when stand button is pressed 2021-11-03 10:21:55 +01:00
ephphatha 6d545868d2 Move objectIsDisabled to a member function
While it does reference a global configuration option it's mainly concerned with the properties of the object itself, so makes sense to be a member of the object class.
2021-10-31 14:21:57 +01:00
Anders Jenbo c0c97bf224 [gamepad] Operate object as last option for primery action
Fixes #3307
2021-10-28 22:47:47 +02:00
staphen f090da3ca8 [Gamepad] Prevent player applying stat points to maxed stat 2021-10-28 08:36:19 +02:00
qndel 9c10f43019 disable using crippling shrines with controller 2021-10-26 22:31:16 +02:00
staphen 85f0e7b8c3 Add button for standing still to attack 2021-10-26 07:54:51 +02:00